人人爽天天爽夜夜爽qc-人人爽天天爽夜夜爽曰-人人天天爱天天做天天摸-人人天天夜夜-色网站在线-色网站在线看

您現在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內容

幫我看下我編寫的東西好嗎為什么出現句末木有分號 [金字塔]

  • 咨詢內容: 剛剛用金字塔格式的傳上去不能正常顯示,這個是TXT文檔的類型 下載信息  [文件大小:   下載次數: ]點擊瀏覽該文件:123.txt

     

  • 金字塔客服: 以前說程序不能直接復制到回復區,現在就放在TXT文檔中

     

  • 用戶回復: 已經出現了好幾次這種情況了。有點郁悶

     

  • 網友回復:


    //開始編寫屬于您自己的交易指標吧!GO!

    //該模型為簡單示范模型,用戶需根據自己交易經驗,修改完善后再實際應用!!!

    //author: fjasmine


    input: t20(20,15,60,1);//參數名,缺省值,最小值,最大值,步長
    input: t10(10,10,30,1);

    input: atrlen(20,15,30,1);

    input: posnum(1,1,20,1);

    variable:daycount=1,positioncount=1,sellsign=0;//定義了三個常數變量,分別賦值

    variable:entandexitsign=1,entpoint=0,exitpoint=0;//定義了三個常數變量,分別賦值

    variable:n=0;//定義常數變量N,初始化值為0

     
    ma1:ma(c,5);//輸出五日均價

    ma2:ma(c,10);//輸出十日均價

    m:=ma(tr,20);//輸出20日均價

    buyhhv:=hhv(h,20);//20日最高價

    sellllv:=llv(l,10);//20日最低價

     

    ss:n,linethick0;


    nt:=1;//調試信息帶有時間戳

    buyorderthisbar:=0;//當前BAR有過交易

     
    variable: _debug = 1; //是否輸出前臺的交易指令

    variable: _tdebug = 1;    //是否輸出后臺的交易指令

    variable: _debugout = 0;  //是否輸出后臺交易的調試信息

     

    variable: myentryprice = 0;//開倉價格

    variable: myxitprice = 0;//平倉價格

     

    variable: turtleunits = 0;//交易單位

    variable: position = 0;//倉位狀態

     

    //0表示沒有倉位,1表示持有多頭,-1表示持有空頭

     

    variable: t20hi=close;

    variable: t20lo=close;

     

    variable: t10hi=close;

    variable: t10lo=close;

     

    //需要準備計算的變量

    t20hi=:ref(hhv(h,t20),1);//

    t20lp=:ref(llv(h,t20),1);//

     

    t10hi=:ref(hhv(h,t10),1);

    t10lo=:ref(llv(h,t10),1);

     

    avgtr:=ref(ma(tr,atrlen),1);

     

    //開始執行時,初始化數據

     

    if barpos = 1 then begin

     //position : = 0;

     

     end//if

     

     //如果是當時沒有持倉的狀態

    if position=0 and barpos > t20 andh>l then begin

     

           //建立多頭進場條件

         

           long:=h>t20hi;

         

           //多頭進場

           iflong then begin

                  myentryprice:=if(open>t20hi+mindiff,open,t20hi+mindiff);

                  buy(_debug,posnum,limitr,myentryprice);

                  position:=1;

                  turtleunits:=1;

                  n:=avgtr;

                  buyorderthisbar:=1;

                

                  end//IF

         

           //建立空頭進場條件

           short:=l<t20lo;

         

           //空頭進場

           ifshort and position=0 then begin

                         myentryprice:=if(open<t20lo-mindiff,open,t20lo-mindiff);

                         buyshort(_debug,posnum,limitr,myentryprice);

                         position:=-1;

                         turtleunits:=1;

                         n:=avgtr;

                         buyorderthisbar:=1;

                  end

                 //不要轉跳,讓程序檢查同一根K線是否可以加倉

                  //gotocontinueline;

                

           end//if

         

           //如果當前持有多頭倉位的狀態

           ifposition=1 and barpos>t20 and h>l then begin

                  //多頭加倉條件

                  while(high>myentryprice+0.5*n) and turtleunits < 4 do begin

                  myentryprice:=if(open>myentryprice+0.5*n,open,myentryprice+0.5*n);

                  myentryprice:=ceiling(myentryprice/mindiff)*mindiff;

                  buy(_debug,posnum,limitr,myentryprice);

                  turtleunits:=turtleunits+1;

                  buyorderthisbar:=1;

                

           end//while循環結束

         

         

           //建立多頭離場條件

           longx1:=(low<t10lo);

         

           iflongx1 and buyorderthisbar=0 then begin

                  myexitprice:=if(open<t10lo-mindiff,open,t10lo-mindiff);

                  sell(_debug,0,limitr,myexitprice);

                  position:=0;

                  turtleunits:=0;

           end

         

         

           //建立多頭止損條件

           longx2:= (low<myentryprice-2*n);

         

           iflongx2 and position = 1 and buyorderthisbar=0 then begin

                  myexitprice:=if(open<myentryprice-2*n,open,myentryprice-2*n);

                  myexitprice:=floor(myexitprice/mindiff)*mindiff;

                  sell(_debug,0,limitr,myexitprice);

                  position:=0;

                  turtleunits:=0;

           end

         

           goto  continueline;

     

    end //if

    if barpos >= 21  or barpos=21 then begin//如果從上市到交易日大于21天那么

    if barpos =21 then//如果從上市到現在加以日等于21,那么

    n:=m;//n=m

    if daycount =6 or barpos = 21 then begin//五天調整N值

    n:=(19*n+tr)/20;//計算N的值

    daycount:=2;

    end

    daycount:=daycount+1;

    entpoint:=enterbars+1;

    if entpoint=entandexitsign then begin//說明stop指令買進頭寸成功

    positioncount:=positioncount+1;//頭寸計數

    sellsign:=true;//開始以stop賣出,如果達到指定的價格

    end

    if positioncount=1 then begin//第一頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open1:buy(h>=enterprice+0.5*n,how,market);//在20日新高stop指令買進

    end

    if positioncount = 2 then begin//第二頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open2:buy(h>enterprice+0.5*n,how,market);//在上頭寸(即第一頭寸)+0.5個N新高stop指令買進

    end

    if positioncount=3 then begin//第三頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open3:buy(h>=enterprice+0.5*n,how,market);//在上頭寸(即第二頭寸)+0.5個N新高stop指令買進

    end

    if positioncount = 4 then begin //第四頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open4:buy(h>=enterprice+0.5*n,how,market);     //在上頭寸(即第三頭寸)+0.5個N新高stop指令買進

    end

     

    if sellsign = true then begin

           exitpoint:=exitbars+1;

           ifexitpoint = entandexitsign then begin //說明賣出成功

                  positioncount:=1;{頭寸計算復原}

                  sellsign:=false;

           end

           ifenterprice-2*n then sell(l<sellllv,100%,market);{退出虧損頭寸}

                  else

                  sell(l<enterprice-2*n,100%,market);

           end

    end

     
     
    //顯示賬號信息:

     

    continueline@ mycount:asset,linethick0;//顯示我的資產

    available_cash:cash(0),linethick0;//可用現金

    pos:holding,linethick0;

    toaldaytrade1:totaldaytrade,linethick0;//總交易次數

     

    if _debugout>0 then begin

           debugfile2('c:debugfile.txt','barpos=%.of',barpos,nt);

           debugfile2('c:debugfile.txt','t20hi=%.2f',t20hi,nt);

           debugfile2('c:debugfile.txt','n=%.2f',n,nt);

           debugfile2('c:debugfile.txt','close=%.2f',c,nt);

           debugfile2('c:debugfile.txt','position=%.2f',position,nt);

           debugfile2('c:debugfile.txt','turtleunits=%.of',turtleunits,nt);

           debugfile2('c:debugfile.txt','myentryprice=%.of',myentryprice,nt);

           debugfile2('c:debugfile.txt','myexitprice=%.of',myexitprice,nt);

    end


    the currentposition:holding,colorgray,linethick0;//當前持倉

    the currentcaptal:asset,noaxis,colorgray;//當前資產

     

     

     

    改好了,但是你這個很多變量后面少了空格是什么情況?

    [此貼子已經被作者于2013/7/30 9:31:14編輯過]

     

  • 網友回復: 以下是引用jinzhe在2013/7/30 9:30:41的發言:


    //開始編寫屬于您自己的交易指標吧!GO!

    //該模型為簡單示范模型,用戶需根據自己交易經驗,修改完善后再實際應用!!!

    //author: fjasmine


    input: t20(20,15,60,1);//參數名,缺省值,最小值,最大值,步長
    input: t10(10,10,30,1);

    input: atrlen(20,15,30,1);

    input: posnum(1,1,20,1);

    variable:daycount=1,positioncount=1,sellsign=0;//定義了三個常數變量,分別賦值

    variable:entandexitsign=1,entpoint=0,exitpoint=0;//定義了三個常數變量,分別賦值

    variable:n=0;//定義常數變量N,初始化值為0

     
    ma1:ma(c,5);//輸出五日均價

    ma2:ma(c,10);//輸出十日均價

    m:=ma(tr,20);//輸出20日均價

    buyhhv:=hhv(h,20);//20日最高價

    sellllv:=llv(l,10);//20日最低價

     

    ss:n,linethick0;


    nt:=1;//調試信息帶有時間戳

    buyorderthisbar:=0;//當前BAR有過交易

     
    variable: _debug = 1; //是否輸出前臺的交易指令

    variable: _tdebug = 1;    //是否輸出后臺的交易指令

    variable: _debugout = 0;  //是否輸出后臺交易的調試信息

     

    variable: myentryprice = 0;//開倉價格

    variable: myxitprice = 0;//平倉價格

     

    variable: turtleunits = 0;//交易單位

    variable: position = 0;//倉位狀態

     

    //0表示沒有倉位,1表示持有多頭,-1表示持有空頭

     

    variable: t20hi=close;

    variable: t20lo=close;

     

    variable: t10hi=close;

    variable: t10lo=close;

     

    //需要準備計算的變量

    t20hi=:ref(hhv(h,t20),1);//

    t20lp=:ref(llv(h,t20),1);//

     

    t10hi=:ref(hhv(h,t10),1);

    t10lo=:ref(llv(h,t10),1);

     

    avgtr:=ref(ma(tr,atrlen),1);

     

    //開始執行時,初始化數據

     

    if barpos = 1 then begin

     //position : = 0;

     

     end//if

     

     //如果是當時沒有持倉的狀態

    if position=0 and barpos > t20 andh>l then begin

     

           //建立多頭進場條件

         

           long:=h>t20hi;

         

           //多頭進場

           iflong then begin

                  myentryprice:=if(open>t20hi+mindiff,open,t20hi+mindiff);

                  buy(_debug,posnum,limitr,myentryprice);

                  position:=1;

                  turtleunits:=1;

                  n:=avgtr;

                  buyorderthisbar:=1;

                

                  end//IF

         

           //建立空頭進場條件

           short:=l<t20lo;

         

           //空頭進場

           ifshort and position=0 then begin

                         myentryprice:=if(open<t20lo-mindiff,open,t20lo-mindiff);

                         buyshort(_debug,posnum,limitr,myentryprice);

                         position:=-1;

                         turtleunits:=1;

                         n:=avgtr;

                         buyorderthisbar:=1;

                  end

                 //不要轉跳,讓程序檢查同一根K線是否可以加倉

                  //gotocontinueline;

                

           end//if

         

           //如果當前持有多頭倉位的狀態

           ifposition=1 and barpos>t20 and h>l then begin

                  //多頭加倉條件

                  while(high>myentryprice+0.5*n) and turtleunits < 4 do begin

                  myentryprice:=if(open>myentryprice+0.5*n,open,myentryprice+0.5*n);

                  myentryprice:=ceiling(myentryprice/mindiff)*mindiff;

                  buy(_debug,posnum,limitr,myentryprice);

                  turtleunits:=turtleunits+1;

                  buyorderthisbar:=1;

                

           end//while循環結束

         

         

           //建立多頭離場條件

           longx1:=(low<t10lo);

         

           iflongx1 and buyorderthisbar=0 then begin

                  myexitprice:=if(open<t10lo-mindiff,open,t10lo-mindiff);

                  sell(_debug,0,limitr,myexitprice);

                  position:=0;

                  turtleunits:=0;

           end

         

         

           //建立多頭止損條件

           longx2:= (low<myentryprice-2*n);

         

           iflongx2 and position = 1 and buyorderthisbar=0 then begin

                  myexitprice:=if(open<myentryprice-2*n,open,myentryprice-2*n);

                  myexitprice:=floor(myexitprice/mindiff)*mindiff;

                  sell(_debug,0,limitr,myexitprice);

                  position:=0;

                  turtleunits:=0;

           end

         

           goto  continueline;

     

    end //if

    if barpos >= 21  or barpos=21 then begin//如果從上市到交易日大于21天那么

    if barpos =21 then//如果從上市到現在加以日等于21,那么

    n:=m;//n=m

    if daycount =6 or barpos = 21 then begin//五天調整N值

    n:=(19*n+tr)/20;//計算N的值

    daycount:=2;

    end

    daycount:=daycount+1;

    entpoint:=enterbars+1;

    if entpoint=entandexitsign then begin//說明stop指令買進頭寸成功

    positioncount:=positioncount+1;//頭寸計數

    sellsign:=true;//開始以stop賣出,如果達到指定的價格

    end

    if positioncount=1 then begin//第一頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open1:buy(h>=enterprice+0.5*n,how,market);//在20日新高stop指令買進

    end

    if positioncount = 2 then begin//第二頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open2:buy(h>enterprice+0.5*n,how,market);//在上頭寸(即第一頭寸)+0.5個N新高stop指令買進

    end

    if positioncount=3 then begin//第三頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open3:buy(h>=enterprice+0.5*n,how,market);//在上頭寸(即第二頭寸)+0.5個N新高stop指令買進

    end

    if positioncount = 4 then begin //第四頭寸

    how:=cash(0)*0.01/n;//波動性百分比決定頭寸規模

    open4:buy(h>=enterprice+0.5*n,how,market);     //在上頭寸(即第三頭寸)+0.5個N新高stop指令買進

    end

     

    if sellsign = true then begin

           exitpoint:=exitbars+1;

           ifexitpoint = entandexitsign then begin //說明賣出成功

                  positioncount:=1;{頭寸計算復原}

                  sellsign:=false;

           end

           ifenterprice-2*n then sell(l<sellllv,100%,market);{退出虧損頭寸}

                  else

                  sell(l<enterprice-2*n,100%,market);

           end

    end

     
     
    //顯示賬號信息:

     

    continueline@ mycount:asset,linethick0;//顯示我的資產

    available_cash:cash(0),linethick0;//可用現金

    pos:holding,linethick0;

    toaldaytrade1:totaldaytrade,linethick0;//總交易次數

     

    if _debugout>0 then begin

           debugfile2('c:debugfile.txt','barpos=%.of',barpos,nt);

           debugfile2('c:debugfile.txt','t20hi=%.2f',t20hi,nt);

           debugfile2('c:debugfile.txt','n=%.2f',n,nt);

           debugfile2('c:debugfile.txt','close=%.2f',c,nt);

           debugfile2('c:debugfile.txt','position=%.2f',position,nt);

           debugfile2('c:debugfile.txt','turtleunits=%.of',turtleunits,nt);

           debugfile2('c:debugfile.txt','myentryprice=%.of',myentryprice,nt);

           debugfile2('c:debugfile.txt','myexitprice=%.of',myexitprice,nt);

    end


    the currentposition:holding,colorgray,linethick0;//當前持倉

    the currentcaptal:asset,noaxis,colorgray;//當前資產

     
    此主題相關圖片如下:8$n0{ih0v12k2gdd557psg.jpg

     

     

    改好了,但是你這個很多變量后面少了空格是什么情況?



    剛剛用你改好的:


    [此貼子已經被作者于2013/7/30 9:31:14編輯過]

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

可聯系技術人員 QQ: 511411198  點擊這里給我發消息進行 有償 編寫!不貴!點擊查看價格!


【字體: 】【打印文章】【查看評論

相關文章

    沒有相關內容
主站蜘蛛池模板: 日本三级做a全过程在线观看 | 男女啪啪免费体验区 | 四虎永久在线精品波多野结衣 | 久久国产综合 | 色在线免费观看 | 亚洲精品欧美日本中文字幕 | 成人国产精品免费网站 | 欧美一级专区免费大片俄罗斯 | 曰批视频在线观看 | 2021免费日韩视频网 | 免费777my性欧美另类 | 2020国产精品永久在线观看 | 国产成人精品日本亚洲语音2 | 亚洲国产精品久久久天堂 | 日韩欧美亚洲中字幕在线播放 | 日韩伦理影片 | 麻豆国产精品有码在线观看 | 欧美a网站 | 日韩午夜 | 99re视频在线观看 | 欧美一级片手机在线观看 | 国产视频你懂的 | 看真人一级毛多毛片 | 一级做a爱 | 久久精品国产精品青草不卡 | 午夜视频在线看 | 美女视频黄的全免费网站 | 一级欧美在线的视频 | 国产精品一区视频 | 顶级毛片在线手机免费看 | 国产精品亚洲精品观看不卡 | 最近最新中文字幕高清免费 | 一区福利视频 | www.五月天激情| 欧美天堂在线 | 日韩黄色网 | 伊人射| 日本三级视频在线 | 亚洲国产激情一区二区三区 | 一区视频在线播放 | 在线观看视频日韩 |