中文字幕av无码不卡免费_蜜臀AV无码精品人妻色欲_亚洲成AV人片在线观看无码不卡_无码专区天天躁天天躁在线

您現在的位置:程序化交易>> 期貨公式>> (MC)multicharts>> MC知識>>正文內容

代碼問題,求教 [MC]

  • MC用戶求助:

    只是想實現 止損后,反手交易,并且手數翻倍。

    所以手數應該是1 2 4 8 16 32 這樣倍增。

    但現在總是出現跳躍,不知道是為什么。

    不用一定在哪個品種上測試,小品種上都可以測試,螺紋,大豆,豆粕等等都行。

    例如下圖1 2 4 然后沒有8 直接跳到了16 。

    32后 直接跳到了128

    是和模式(bar內?)有關?還是代碼?

    ?

    全部代碼如下:

    inputs:

    ? ? ? ? ?Zhiyingx( 9999) , ? ? ?

    Zhiying( 9999) ,

    Zhisun( 5 ) ;

    ? ? ? ?

    ?

    variables:

    ? ?nn(4) ,

    ? ? ? ? ?ww(3) , ? ? ??

    ?

    var0( 0 ), var1( 0 ), var2( 0 ),Length( 20 ),Zhiyings( 20 ),TNUMSEQLOSS( 0 ),

    shoushua( 1 ), shoushu(1), yici(0)?

    ;

    ?

    yici=0;

    var0 = BollingerBand( Close, Length, 1 ) ;

    var1 = BollingerBand( Close , Length, -1 ) ;

    var2 = Average(C,Length);

    ?

    ?

    condition3 = TIME>900 and TIME<2300;

    ?

    condition1 = c[1]>o[1] and c[1]>Average(c[1],26) and condition3 ;;

    ?

    condition2 = c[1]<o[1] and c[1]<Average(c[1],26) and condition3 ;;

    ?

    ?

    if TNUMSEQLOSS<ww then begin

    Zhiyings=Zhiying;

    end

    Else begin

    ? ? ? ?Zhiyings=Zhiyingx;

    end;

    ?

    if TNUMSEQLOSS<nn then begin

    shoushua=shoushu;

    end

    Else begin

    ? ? ? ? shoushu=0.5;

    ? ? ? ?end;

    ?

    ?

    ?

    ?

    condition4 = CurrentBar > 1 and H>Zhisun+avgentryprice and marketposition=-1 and condition3 ;

    ?

    condition5 = CurrentBar > 1 and l<avgentryprice-Zhisun and marketposition=1 and condition3 ;

    ?

    ?

    condition6 = CurrentBar > 1 and l<avgentryprice-Zhiyings and marketposition=-1 and condition3 ;

    ?

    condition7 = CurrentBar > 1 and h>avgentryprice+Zhiyings and marketposition=1 and condition3 ;

    ?

    ?

    if (condition1 or yici[1]=1) ?and marketposition=0 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    Buy ( "kai1" ) 1 Contract next bar at Open stop ;

    ?

    end;

    ?

    if (condition2 or yici[1]=-1) and marketposition=0 ?then begin

    ?

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    Sell Short ( "kai2" ) 1 Contract ?next bar at Open stop ;

    ?

    end;

    ?

    if condition4 ?and condition5=False then begin

    ? ? ? ? ? TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? print(date," ",time," buy ?TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," buy ?shoushu: ",shoushu);

    ?

    buy ?( "kui1" ) ?shoushu Contracts ? ? ? next bar at Zhisun+avgentryprice ?stop ;

    end;

    ?

    ?

    ?

    if condition5 and condition4=False then begin

    ?

    ? ? ? ? ? ?TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? ?print(date," ",time," sellshort TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? ?shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," sellshort shoushu: ",shoushu);

    sellshort( "kui2" ) ?shoushu Contracts ? ?next bar at avgentryprice-Zhisun ?stop ;

    ?

    end;

    ?

    ?

    if condition6 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    buytocover ?( "ying1" ) next bar at avgentryprice-Zhiyings ?stop ;

    shoushu=1;

    TNUMSEQLOSS=0;

    yici=-1;

    end;

    ?

    if condition7 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    sell( "ying2" ) next bar at avgentryprice+Zhiyings stop ;

    shoushu=1;

    ? ? ? ?TNUMSEQLOSS=0;

    ? ? ? ?yici=1;

    end;

    ?

    ?

  • MC回復討論一:

    if condition4 ?and condition5=False then begin

    ? ? ? ? ? TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? print(date," ",time," buy ?TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," buy ?shoushu: ",shoushu);

    buy ?( "kui1" ) ?shoushu Contracts ? ? ? next bar at Zhisun+avgentryprice ?stop ;

    end;

    if condition5 and condition4=False then begin

    ? ? ? ? ? ?TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? ?print(date," ",time," sellshort TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? ?shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," sellshort shoushu: ",shoushu);

    sellshort( "kui2" ) ?shoushu Contracts ? ?next bar at avgentryprice-Zhisun ?stop ;

    end;

    以上代碼是您累加變量TNUMSEQLOSS的地方,也是問題的所在,之所以出現”跳躍“是因為重復累加,也就是條件連續滿足導致連續累加;因為您使用的是條件單,而條件單不一定委托出去就會成交,但是您在條件成立時肯定會累加變量TNUMSEQLOSS,所以導致兩者的不一致;解決方法是,確定條件單成交之后再累加變量TNUMSEQLOSS

    ?

    ?

  • MC回復討論二:

    判斷是否成交的方法有很多:

    第一、在沒有加倉的情況下,通過當根bar的marketposition與前一根bar的marketposition的信息對比進行判斷,但是由于marketposition沒有回溯的功能,但您需要先將marketposition的值賦值給新建的變量mp,然后通過判斷mp[1]<>mp

    第二、在有加倉的情況下,您還需要考慮關鍵字currentcontracts等持倉部位信息的變化,以此來判斷。

    第三、策略屬性中有重新計算的設置,可以勾選“委托單成交”,這個用來判斷委托單成交有點復雜,不建議使用。

    ?

  • MC回復討論三:

    inputs:

    ? ? ? ? ?Zhiyingx( 9999) , ? ? ?

    Zhiying( 9999) ,

    Zhisun( 5 ) ;

    ? ? ? ?

    ?

    variables:

    ? ?nn(4) ,

    ? ? ? ? ?ww(3) , ? ? ??

    ?

    var0( 0 ), var1( 0 ), var2( 0 ),Length( 20 ),Zhiyings( 20 ),TNUMSEQLOSS( 0 ),

    shoushua( 1 ), shoushu(1), yici(0), mp(0);;

    ?

    yici=0;

    var0 = BollingerBand( Close, Length, 1 ) ;

    var1 = BollingerBand( Close , Length, -1 ) ;

    var2 = Average(C,Length);

    ?

    ?

    condition3 = TIME>900 and TIME<2300;

    ?

    condition1 = c[1]>o[1] and c[1]>Average(c[1],26) and condition3 ;;

    ?

    condition2 = c[1]<o[1] and c[1]<Average(c[1],26) and condition3 ;;

    ?

    ?

    if TNUMSEQLOSS<ww then begin

    Zhiyings=Zhiying;

    end

    Else begin

    ? ? ? ?Zhiyings=Zhiyingx;

    end;

    ?

    if TNUMSEQLOSS<nn then begin

    shoushua=shoushu;

    end

    Else begin

    ? ? ? ? shoushu=0.5;

    ? ? ? ?end;

    ?

    ?

    mp=marketposition;

    ?

    condition4 = CurrentBar > 1 and H>Zhisun+avgentryprice and marketposition=-1 and condition3 ?and ?mp[1]<>mp;

    ?

    condition5 = CurrentBar > 1 and l<avgentryprice-Zhisun and marketposition=1 and condition3 and ?mp[1]<>mp;

    ?

    ?

    condition6 = CurrentBar > 1 and l<avgentryprice-Zhiyings and marketposition=-1 and condition3 ;

    ?

    condition7 = CurrentBar > 1 and h>avgentryprice+Zhiyings and marketposition=1 and condition3 ;

    ?

    ?

    if (condition1 or yici[1]=1) ?and marketposition=0 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    Buy ( "kai1" ) 1 Contract next bar at Open stop ;

    ?

    end;

    ?

    if (condition2 or yici[1]=-1) and marketposition=0 ?then begin

    ?

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    Sell Short ( "kai2" ) 1 Contract ?next bar at Open stop ;

    ?

    end;

    ?

    if condition4 ?and condition5=False then begin

    ? ? ? ? ? TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? print(date," ",time," buy ?TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," buy ?shoushu: ",shoushu);

    ?

    buy ?( "kui1" ) ?shoushu Contracts ? ? ? next bar at Zhisun+avgentryprice ?stop ;

    ?

    ?

    end;

    ?

    ?

    ?

    if condition5 and condition4=False then begin

    ?

    ? ? ? ? ? ?TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? ?print(date," ",time," sellshort TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? ?shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," sellshort shoushu: ",shoushu);

    sellshort( "kui2" ) ?shoushu Contracts ? ?next bar at avgentryprice-Zhisun ?stop ;

    ?

    end;

    ?

    ?

    if condition6 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    buytocover ?( "ying1" ) next bar at avgentryprice-Zhiyings ?stop ;

    shoushu=1;

    TNUMSEQLOSS=0;

    yici=-1;

    end;

    ?

    if condition7 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    sell( "ying2" ) next bar at avgentryprice+Zhiyings stop ;

    shoushu=1;

    ? ? ? ?TNUMSEQLOSS=0;

    ? ? ? ?yici=1;

    end;

    ?

    ?

    ?

    我按照您說的改了,這樣基本交易1,2次就不交易了,這是怎么回事?

    ?

  • MC回復討論四:

    inputs:

    ? ? ? ? ?Zhiyingx( 9999) , ? ? ?

    Zhiying( 9999) ,

    Zhisun( 5 ) ;

    ? ? ? ?

    ?

    variables:

    ? ?nn(4) ,

    ? ? ? ? ?ww(3) , ? ? ??

    ?

    var0( 0 ), var1( 0 ), var2( 0 ),Length( 20 ),Zhiyings( 20 ),TNUMSEQLOSS( 0 ),

    shoushua( 1 ), shoushu(1), yici(0), mp(0);;

    ?

    yici=0;

    var0 = BollingerBand( Close, Length, 1 ) ;

    var1 = BollingerBand( Close , Length, -1 ) ;

    var2 = Average(C,Length);

    ?

    ?

    condition3 = TIME>900 and TIME<2300;

    ?

    condition1 = c[1]>o[1] and c[1]>Average(c[1],26) and condition3 ;;

    ?

    condition2 = c[1]<o[1] and c[1]<Average(c[1],26) and condition3 ;;

    ?

    ?

    if TNUMSEQLOSS<ww then begin

    Zhiyings=Zhiying;

    end

    Else begin

    ? ? ? ?Zhiyings=Zhiyingx;

    end;

    ?

    if TNUMSEQLOSS<nn then begin

    shoushua=shoushu;

    end

    Else begin

    ? ? ? ? shoushu=0.5;

    ? ? ? ?end;

    ?

    ?

    mp=marketposition;

    ?

    condition4 = CurrentBar > 1 and H>Zhisun+avgentryprice and marketposition=-1 and condition3 ?and ?mp[1]<>mp;

    ?

    condition5 = CurrentBar > 1 and l<avgentryprice-Zhisun and marketposition=1 and condition3 and ?mp[1]<>mp;

    ?

    ?

    condition6 = CurrentBar > 1 and l<avgentryprice-Zhiyings and marketposition=-1 and condition3 ;

    ?

    condition7 = CurrentBar > 1 and h>avgentryprice+Zhiyings and marketposition=1 and condition3 ;

    ?

    ?

    if (condition1 or yici[1]=1) ?and marketposition=0 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    Buy ( "kai1" ) 1 Contract next bar at Open stop ;

    ?

    end;

    ?

    if (condition2 or yici[1]=-1) and marketposition=0 ?then begin

    ?

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    Sell Short ( "kai2" ) 1 Contract ?next bar at Open stop ;

    ?

    end;

    ?

    if condition4 ?and condition5=False then begin

    ? ? ? ? ? TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? print(date," ",time," buy ?TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," buy ?shoushu: ",shoushu);

    ?

    buy ?( "kui1" ) ?shoushu Contracts ? ? ? next bar at Zhisun+avgentryprice ?stop ;

    ?

    ?

    end;

    ?

    ?

    ?

    if condition5 and condition4=False then begin

    ?

    ? ? ? ? ? ?TNUMSEQLOSS=TNUMSEQLOSS+1;

    ? ? ? ? ? ?print(date," ",time," sellshort TNUMSEQLOSS: ",TNUMSEQLOSS);

    ? ? ? ? ? ?shoushu=Power(2,TNUMSEQLOSS);?

    ? ? ? ? ? ?print(date," ",time," sellshort shoushu: ",shoushu);

    sellshort( "kui2" ) ?shoushu Contracts ? ?next bar at avgentryprice-Zhisun ?stop ;

    ?

    end;

    ?

    ?

    if condition6 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    buytocover ?( "ying1" ) next bar at avgentryprice-Zhiyings ?stop ;

    shoushu=1;

    TNUMSEQLOSS=0;

    yici=-1;

    end;

    ?

    if condition7 then begin

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    sell( "ying2" ) next bar at avgentryprice+Zhiyings stop ;

    shoushu=1;

    ? ? ? ?TNUMSEQLOSS=0;

    ? ? ? ?yici=1;

    end;

    ?

    ?

    ?

    我按照您說的改了,這樣基本交易1,2次就不交易了,這是怎么回事?

 

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

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


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

相關文章

    沒有相關內容
中文字幕av无码不卡免费_蜜臀AV无码精品人妻色欲_亚洲成AV人片在线观看无码不卡_无码专区天天躁天天躁在线

欧美日韩中文| 欧美国产亚洲另类动漫| 欧美成人视屏| 亚洲女人av| 99精品国产福利在线观看免费| 激情五月婷婷综合| 国产欧美91| 国产精品麻豆成人av电影艾秋| 欧美久久一级| 欧美高清视频一区二区三区在线观看 | 一区二区三区在线视频观看| 国产精品精品视频| 欧美亚日韩国产aⅴ精品中极品| 欧美国产一区二区在线观看| 免费亚洲电影| 欧美a级片一区| 免费观看亚洲视频大全| 老司机67194精品线观看| 久久综合999| 久久精品国产综合精品| 久久精品欧美日韩精品| 亚洲黄色在线看| 欧美日韩一二区| 欧美午夜精品久久久久久超碰| 欧美视频在线观看| 国产精品www.| 国产欧美日韩亚洲精品| 国产午夜亚洲精品不卡| 国产精品一区二区在线| 国产麻豆日韩欧美久久| 国产亚洲精品久| 韩国三级电影一区二区| 亚洲欧美成人精品| 欧美激情第4页| 欧美国产视频一区二区| 欧美日韩精品一本二本三本| 欧美日韩一区二区三区高清| 国产精品日韩欧美一区二区三区| 国产毛片一区| 国产一区在线播放| 激情亚洲网站| 亚洲精品久久久久久一区二区| 亚洲美女黄色片| 中文欧美在线视频| 久久影视精品| 国产一区二区三区免费不卡| 狠狠色伊人亚洲综合网站色| 亚洲国产成人av| 日韩视频在线观看一区二区| 国产精品99久久99久久久二8| 午夜久久久久| 老司机精品视频网站| 欧美日韩一区二区在线观看 | 久久久噜久噜久久综合| 一区二区三区日韩精品| 久久夜色精品国产| 欧美黄色免费网站| 国产精品夜夜夜一区二区三区尤| 激情欧美一区二区三区| 99国产一区| 久久国产婷婷国产香蕉| 欧美欧美天天天天操| 国产日韩欧美二区| 亚洲日本欧美天堂| 欧美一区二区精品在线| 猫咪成人在线观看| 国产精品久久综合| 91久久在线播放| 好吊色欧美一区二区三区四区| 91久久精品国产91久久| 亚洲欧美视频| 欧美精品18+| 国产在线播精品第三| 一区二区三区视频在线播放| 久久青草福利网站| 欧美午夜一区| 1024欧美极品| 午夜一区二区三区在线观看| 欧美a级在线| 国产亚洲人成网站在线观看| 国产婷婷色一区二区三区| 国产精品国产一区二区| 亚洲高清在线视频| 欧美一级理论性理论a| 欧美区一区二区三区| 狠狠色狠狠色综合日日tαg| 亚洲小说春色综合另类电影| 欧美大片在线观看一区二区| 国产一区二区毛片| 亚洲午夜久久久久久久久电影院| 欧美~级网站不卡| 国产午夜精品全部视频在线播放| 宅男噜噜噜66一区二区66| 性欧美18~19sex高清播放| 久久高清福利视频| 国产精品视频99| 在线一区二区三区四区| 欧美成人免费va影院高清| 国内成人自拍视频| 性视频1819p久久| 国产精品jizz在线观看美国| 亚洲乱码精品一二三四区日韩在线 | 国产精品美女视频网站| 性做久久久久久久免费看| 亚洲成人自拍视频| 久久久国际精品| 国产日韩精品一区二区浪潮av| 亚洲图色在线| 欧美日韩一视频区二区| 亚洲毛片av在线| 欧美激情精品久久久久久大尺度| 在线成人黄色| 久久夜色精品亚洲噜噜国产mv| 国产午夜精品美女视频明星a级| 校园激情久久| 国产欧美日韩综合一区在线观看| 亚洲在线观看免费| 欧美肥婆bbw| 国产精品成人久久久久| 一区二区三区导航| 欧美视频精品一区| 亚洲视频在线观看视频| 欧美四级伦理在线| 亚洲特黄一级片| 国产精品欧美经典| 香蕉久久久久久久av网站 | 国内精品视频在线观看| 欧美在线观看网站| 国产最新精品精品你懂的| 久久aⅴ国产紧身牛仔裤| 欧美 日韩 国产一区二区在线视频 | 日韩网站在线看片你懂的| 欧美激情视频一区二区三区在线播放 | 亚洲视频在线观看三级| 国产精品成人一区二区三区吃奶| 亚洲一区二区精品在线观看| 久久精品一区二区三区不卡| 欧美精品日韩一本| 一区二区三区视频在线观看| 国产精品红桃| 久久av资源网站| 在线视频国内自拍亚洲视频| 欧美成人午夜剧场免费观看| 一个色综合导航| 国产裸体写真av一区二区| 久久精品综合| 亚洲国产精品电影在线观看| 欧美日韩国产美女| 亚洲尤物精选| 国产一区二区三区四区| 国产伦精品一区二区三区高清版| 欧美激情一区二区三区在线| 亚洲另类视频| 国产精品免费看片| 久久精品国产欧美激情| 91久久精品国产| 国产精品久久毛片a| 久久久www成人免费无遮挡大片| 亚洲国产精品成人综合色在线婷婷| 欧美精品自拍| 午夜精品免费| 91久久精品美女高潮| 国产精品久久久久久av下载红粉| 欧美主播一区二区三区| 亚洲激情成人| 国产精品一区2区| 欧美成人官网二区| 亚洲女同同性videoxma| 激情欧美一区二区三区| 欧美三级在线| 久久久综合精品| 制服诱惑一区二区| 激情六月婷婷久久| 欧美午夜精品久久久久久久| 久久嫩草精品久久久久| 亚洲精品国产拍免费91在线| 国产麻豆精品theporn| 欧美激情精品久久久久久大尺度 | 亚洲视屏一区| 激情欧美丁香| 国产精品久久77777| 久久中文字幕一区| 午夜精品久久久久久久久久久久久| 亚洲国产精品热久久| 国产精品稀缺呦系列在线| 欧美黄色一级视频| 久久精品国产一区二区电影 | 欧美日韩在线免费| 久久国产精品第一页 | 性欧美18~19sex高清播放| 亚洲精品乱码久久久久久| 国产一级揄自揄精品视频| 欧美日韩国产影院| 久久人人爽人人爽爽久久| 亚洲一区二区三区视频| 亚洲日本乱码在线观看| 国模 一区 二区 三区| 国产精品成人一区二区三区吃奶| 欧美aaaaaaaa牛牛影院| 久久精品72免费观看|