中文字幕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人片在线观看无码不卡_无码专区天天躁天天躁在线

亚洲欧美自拍偷拍| 久久高清福利视频| 国产精品一区二区三区免费观看| 欧美激情aⅴ一区二区三区| 国产精品免费区二区三区观看| 国产日韩欧美视频在线| 在线午夜精品自拍| 亚洲第一在线综合在线| 国产综合视频在线观看| 国产精品入口| 国产精品理论片在线观看| 欧美三区在线视频| 欧美日韩亚洲高清| 欧美精品国产精品日韩精品| 欧美福利视频网站| 免费观看一区| 欧美成人小视频| 欧美激情一区二区三区全黄| 欧美精品免费观看二区| 欧美激情四色 | 在线播放不卡| 欲色影视综合吧| 曰韩精品一区二区| 91久久精品一区二区别| 亚洲看片网站| 99精品视频免费全部在线| 在线综合亚洲欧美在线视频| 亚洲制服欧美中文字幕中文字幕| 午夜精品视频在线观看一区二区| 午夜在线精品偷拍| 久久亚洲综合色| 欧美精品观看| 国产精品青草久久| 国产一区二区三区在线观看精品| 国产精品中文在线| 狠狠色丁香婷婷综合| 亚洲国产高清一区| 亚洲精品乱码久久久久久黑人 | 亚洲美洲欧洲综合国产一区| 亚洲精品在线观| 一区二区三区高清在线 | 久久久www免费人成黑人精品| 欧美在线国产| 久久免费视频网| 久久久久综合网| 老司机成人在线视频| 欧美激情在线免费观看| 欧美精品在线观看播放| 欧美日韩一卡| 国模大胆一区二区三区| 亚洲精品乱码久久久久久| 亚洲欧美成人综合| 另类综合日韩欧美亚洲| 国产精品久久国产愉拍| 一区二区视频免费完整版观看| 亚洲精品久久在线| 午夜精品国产更新| 欧美不卡视频一区发布| 国产精品久久久久久久免费软件| 一区视频在线播放| 亚洲视频导航| 久久久久女教师免费一区| 欧美激情久久久久| 国产麻豆日韩| 亚洲三级影院| 欧美一区二区三区喷汁尤物| 米奇777超碰欧美日韩亚洲| 久久综合色影院| 国产精品激情av在线播放| 影音先锋一区| 亚洲欧美一区二区三区在线| 欧美国产一区二区在线观看| 国产精品一级久久久| 亚洲美女av电影| 久久人人97超碰人人澡爱香蕉| 欧美日韩三区四区| **欧美日韩vr在线| 性做久久久久久免费观看欧美| 欧美黄色大片网站| 国内精品一区二区三区| 在线视频欧美日韩| 免费黄网站欧美| 国产亚洲精品激情久久| 99精品视频一区| 麻豆乱码国产一区二区三区| 国产乱码精品1区2区3区| 亚洲精品国精品久久99热一| 久久精品国产久精国产思思| 国产精品久久二区| 亚洲人成在线影院| 久久亚洲国产精品日日av夜夜| 国产精品青草综合久久久久99| 欧美三区美女| 亚洲每日更新| 性感少妇一区| 欧美日韩一区在线视频| 在线免费观看一区二区三区| 午夜性色一区二区三区免费视频| 欧美精品自拍| 亚洲国产美女久久久久 | 久久久久网址| 国产欧美日韩不卡| 亚洲一区欧美| 欧美天堂亚洲电影院在线播放| 亚洲人成高清| 欧美jizzhd精品欧美巨大免费| 国产日韩欧美日韩大片| 亚洲午夜黄色| 欧美三级黄美女| 一区二区日韩免费看| 欧美理论电影在线播放| 亚洲精品国产无天堂网2021| 农村妇女精品| 亚洲国产高清高潮精品美女| 玖玖精品视频| 亚洲高清视频一区二区| 老司机久久99久久精品播放免费| 韩国欧美一区| 亚洲国产欧美一区二区三区同亚洲 | 国产亚洲欧美一区二区| 先锋影音一区二区三区| 国产精品一区视频| 午夜在线电影亚洲一区| 国产精品一区二区久久久| 亚洲欧美日韩专区| 国产有码一区二区| 久久久免费精品| 在线观看日产精品| 蜜桃av一区二区在线观看| 国产在线精品自拍| 久久亚洲精品伦理| 亚洲国产成人tv| 欧美国产专区| 99精品视频免费全部在线| 欧美日韩黄色大片| 亚洲视频图片小说| 国产精品美女www爽爽爽视频| 亚洲欧美一区二区激情| 国产午夜精品麻豆| 久久婷婷成人综合色| 亚洲国产高清在线| 欧美精品www| 亚洲午夜激情| 国产一级一区二区| 老司机免费视频一区二区| 亚洲人成毛片在线播放| 欧美日韩国产美女| 亚洲欧美综合网| 黑人一区二区三区四区五区| 欧美.日韩.国产.一区.二区| 99精品福利视频| 国产美女精品视频| 麻豆成人在线播放| 中国av一区| 国模一区二区三区| 欧美成人一品| 亚洲一区二区三区免费在线观看 | 久久国产欧美精品| 亚洲激情一区二区三区| 国产精品极品美女粉嫩高清在线| 久久国产成人| 亚洲精品久久久久| 国产精品乱人伦一区二区| 久久久天天操| 99riav1国产精品视频| 国产老肥熟一区二区三区| 久久久综合免费视频| 夜夜爽www精品| 国产日韩在线视频| 欧美精品xxxxbbbb| 午夜精品久久| 亚洲精品一线二线三线无人区| 国产精品网曝门| 欧美成人黄色小视频| 亚洲影院在线| 亚洲国产另类久久久精品极度| 国产精品久久91| 免费成人高清视频| 香港成人在线视频| 亚洲欧洲一区二区三区在线观看| 国产精品人人爽人人做我的可爱| 久久蜜臀精品av| 亚洲视频在线播放| 亚洲国产精品视频一区| 校园春色综合网| 日韩西西人体444www| 韩国女主播一区二区三区| 欧美日韩中文在线观看| 久久综合九色| 亚洲欧美日韩在线| 亚洲美女在线一区| 在线看不卡av| 国产精品专区h在线观看| 欧美激情va永久在线播放| 久久久久久91香蕉国产| 亚洲永久字幕| 亚洲伦理在线观看| 在线观看亚洲专区| 国产日韩亚洲欧美| 欧美性猛交xxxx乱大交蜜桃|