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

求助代碼問題。 [MC]

  • MC用戶求助:

    [IntrabarOrderGeneration=False];

    Inputs:X(50);

    inputs: DataSeries1( Close of data1 ), DataSeries2( Close of data2 );

    variable:close1(0),var1(0),sell1(0),sell2(0),sell3(0),sell4(0),sell5(0),sell6(0),buy1(0),buy2(0),buy3(0),buy4(0),buy5(0),buy6(0);

    ?

    ?

    close1=DataSeries1-DataSeries2;

    ?

    ?

    ? var1=-150;

    ? ?sell1=var1+X;

    ? sell2=var1+2*X;

    ? ? sell3=var1+3*X;

    ? ? ? sell4=var1+4*X;

    ? ? ? ? sell5=var1+5*X;

    ? ? ? ? sell6=var1+6*X;

    buy1=var1-X;

    ? buy2=var1-2*X;

    ? buy3=var1-3*X;

    ? buy4=var1-4*X;

    ? buy5=var1-5*X;

    ? ? buy6=var1-6*X;

    ?

    condition1=Close1 cross over ?sell1;

    condition2=Close1 cross over sell2;

    condition3=Close1 cross over sell3;

    condition4=Close1 cross over ?sell4;

    condition5=Close1 cross over ?sell5;

    ?

    {condition11=Close1 < 200;

    condition21=Close1 < ?250;

    condition31=Close1 < 300;

    condition41=Close1 < ?350;

    condition51=Close1 < ? 400;}

    ?

    ?

    condition6=Close1 cross under buy1;

    condition7=Close1 cross under buy2;

    condition8=Close1 cross under buy3;

    condition9=Close1 cross under buy4;

    condition10=Close1 cross under buy5;

    ?

    ?

    ?

    {condition61=Close1 > buy1;

    condition71=Close1 > buy2;

    condition81=Close1 >buy3;

    condition91=Close1 > buy4;

    condition11=Close1 > buy5;}

    ?

    if ?condition1 then sellshort("s1") 1 contracts next bar at market;

    if condition2 then sellshort("s2") 1 contracts next bar at market;

    if ?condition3 ?then sellshort("s3") 1 contracts next bar at market;

    if ?condition4 ?then sellshort("s4") 3 contracts next bar at market;

    if ?condition5 ?then sellshort ("s5")6 contracts next bar at market;

    //if marketposition=1 and condition6 and currentcontracts=12 then sellshort 12 contracts next bar at market;

    if Close1[1] > sell4 ?and Close1 <= sell4 and marketposition=-1 then buytocover from entry("s5") next bar at market;

    if ?Close1[1] > sell3 ?and Close1 <= sell3 and marketposition=-1 ?then buytocover from entry("s4") ?next bar at market;

    if Close1[1] > sell2 ?and Close1<=sell2 and marketposition=-1 ?then buytocover from entry("s3") ?next bar at market;

    if Close1[1] > sell1 and Close1 <= sell1 and marketposition=-1 then buytocover ?from entry("s2") ? next bar at market;

    if Close1[1] > var1 and ?close1 <= var1 ?and marketposition=-1 ? then buytocover from entry("s1") next bar at market;

    if close1<150 ? then buytocover next bar at market;

    ?

    ?

    ?

    if ?condition6 ?then buy("b1") 1 contracts next bar at market;

    if condition7 then buy("b2") 1 contracts next bar at market;

    if ?condition8 ?then buy("b3") 1 contracts next bar at market;

    if ?condition9 ?then buy("b4") 3 contracts next bar at market;

    if ?condition10 ?then buy ("b5")6 contracts next bar at market;

    //if marketposition=1 and condition6 and currentcontracts=12 then sellshort 12 contracts next bar at market;

    if ?Close1[1] < buy4 and ?Close1 >= buy4 and marketposition=1 then buytocover from entry("b5") ?next bar at market;

    if ?Close1[1] < buy3 and ?Close1 >= buy3 and marketposition=1 ?then buytocover from entry("b4") ? next bar at market;

    if ?Close1[1] < buy2 and ?Close1 >= buy2 and marketposition=1 ?then buytocover from entry("b3") ?next bar at market;

    if ?Close1[1] < buy1 and ?Close1 >= buy1 and marketposition=1 then buytocover ?from entry("b2") ? next bar at market;

    if ? Close1[1] < var1 and ?Close1 >= var1 ?and marketposition=1 ? then buytocover from entry("b1") next bar at market;

    if close1>150 ? then sell next bar at market;

    ?

    我想實現類似網格策略,進倉點位正確,平倉點位不正確。如何找出問題

    ?

  • MC回復討論一:

    https://forum.multicharts.cn/forum/cat/0/thread/33
    這個帖子有關于進場出場語句的介紹,另外官網上有網格策略可以看一下。

    您可以在策略關鍵位置使用關鍵字print將該行相關的信息輸出出來進行debug;或者使用commentry進行debug

    從您的代碼來看,buytocover平倉語句對應的是空頭持倉,而sell平倉語句對應的是多頭持倉,這個地方在您的后半段的語句中是錯誤的。

    對于您所說的“進場和平倉點位不正確”,您需要將“不正確”敘述清楚,哪里不正確?

 

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

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


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 欧美黑人videos巨大18tee| 91精品国产免费久久久久久青草| 日本videoshd高清黑人| 亚洲熟妇丰满xxxxx| 美女的尿口无遮掩的照片| 国产精品久久久久久久久电影网 | 久久久亚洲欧洲日产国码aⅴ| 欧美日韩在线视频专区免费| 吃奶摸下的激烈免费视频播放| 欧美在线色视频| 欧美人与性动交另类| 啊灬啊灬啊灬喷出来了| 欧美一级特黄乱妇高清视频| 天天干天天摸天天操| 久久99国产精品久久99| 男人扒开女人下面狂躁动漫版| 国产卡一卡二卡三卡四| 884aa四虎在线| 富二代app免费下载安装ios二维码| 久久精品人人做人人爽| 欧美高清在线精品一区| 农民工嫖妓50岁老熟女| 91制片厂果冻传媒白晶晶| 性一交一乱一视频免费看| 久久狠狠高潮亚洲精品| 欧美大香线蕉线伊人久久| 免费A级毛片AV无码| 老师办公室被吃奶好爽在线观看| 在线观看av片| 中文字幕久久久久| 日韩电影免费在线观看网站| 亚洲欧洲日韩在线电影| 男人进的越深越爽动态图| 国产AV无码专区亚洲AV漫画| 91九色视频在线观看| 国产精品美女www爽爽爽视频| www.com.av| 成全高清视频免费观看| 久久天堂AV综合合色蜜桃网| 理论秋霞在线看免费| 四虎影院永久网址|