大伊人青草狠狠久久-大伊香蕉精品视频在线-大伊香蕉精品一区视频在线-大伊香蕉在线精品不卡视频-大伊香蕉在线精品视频75-大伊香蕉在线精品视频人碰人

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

平倉錯誤 [開拓者 TB]

  • 咨詢內容: 想請教一下,下面是我的代碼,我設置的平多條件是紫色的LLH小于黃色的ma時才能平多,為什么這里給我平了呢?

    ?

    ?來源:CXH99.COM

  • TB技術人員:
    Params
    ? ? ? ???
    ? ? ? ? Numeric N(600);
    ? ? ? ? Numeric FastLength(12);
    ? ? ? ? Numeric SlowLength(26);
    ? ? ? ? Numeric MACDLength(18);
    Numeric FastLength0(500);
    ? ? ? ? Numeric SlowLength0(1000);
    ? ? ? ? Numeric MACDLength0(700);
    Vars
    ? ? ? ? Series<Numeric> LOTS;
    ? ? ? ? Series<Numeric> MA;
    Series<Numeric> MACDValue0;
    ? ? ? ? Series<Numeric> AvgMACD0;
    ? ? ? ? Series<Numeric> Diff0;
    Series<Numeric> MACDValue;
    ? ? ? ? Series<Numeric> AvgMACD;
    ? ? ? ? Series<Numeric> Diff;
    ? ? ? ? Series<Numeric> Diff1;
    Series<Numeric> HH;
    Series<Numeric> HH1;
    Series<Numeric> HHH;
    Series<Numeric> HHL;
    Series<Numeric> HHLB;
    Series<Numeric> LLHB;
    ? ? ? ? Series<Numeric> LL;
    ? ? ? ? Series<Numeric> LL1;
    ? ? ? ? Series<Numeric> LLL;
    ? ? ? ? Series<Numeric> LLH;
    Series<Numeric> FLAG1;
    ? ? ? ? Series<Numeric> FLAG2;
    ? ? ? ? Series<Numeric> FLAG11;
    ? ? ? ? Series<Numeric> FLAG22;
    Series<Numeric> X;
    ? ? ? ? Series<Numeric> Y;
    Series<Numeric> DKH;
    Series<Numeric> DKL;
    Series<Numeric> myPrice;
    Bool validTime;
    Bool ZD1;
    Bool ZD2;
    Bool ZD3;
    Bool ZD4;
    Bool ZK1;
    Bool ZK2;
    Bool ZK3;
    Bool ZK4;
    Bool PD1;
    Bool PK1;




    Events
    ? ? ? ???onBar(ArrayRef<Integer> indexs)
    {
    LOTS=1;

    validTime = (TIME>=0.0900 and time <=0.1500) and (time >=0.2100 and time <=0.0100);

    MA=AverageFC(C[1],N);
    ? ? ? ???

    ? ? ? ? PlotNumeric("MA",ma);


    MACDValue0 = XAverage(Close, FastLength0) - XAverage(Close, SlowLength0) ;
    AvgMACD0= XAverage(MACDValue0,MACDLength0);
    Diff0= MACDValue0[1] - AvgMACD0[1];

    MACDValue = XAverage( Close, FastLength ) - XAverage(Close, SlowLength ) ;
    AvgMACD = XAverage(MACDValue,MACDLength);
    Diff = MACDValue[1] - AvgMACD[1];
    Diff1 = MACDValue[1] - AvgMACD[1];

    IF(diff>0 and diff[1]>0 and diff[2]>0 and diff[3]>0 and diff[4]>0 and diff[5]>0 and diff[6]>0 and diff[7]<0){FLAG1=CurrentBar;}
    IF(diff<0 and diff[1]<0 and diff[2]<0 and diff[3]<0 and diff[4]<0 and diff[5]<0 and diff[6]<0 and diff[7]>0){FLAG2=CurrentBar;}
    x=flag2-FLAG1;
    HH=Highest (H[1],x+7);
    IF(diff<0 and diff[1]<0 and diff[2]<0 and diff[3]<0 and diff[4]<0 and diff[5]<0 and diff[6]<0 and diff[7]>0){HH1=HH;}Else{HH1=HH1[1]; }
    IF(HH1[1]>HH1[2]){HHH=HH1[1];}
    IF(HH1<>HH1[1]){HHLB=CurrentBar;}Else{HHLB=HHLB[1];}
    HHL=Lowest(L[1],CurrentBar[1]-HHLB+7);

    IF(diff1>0 and diff1[1]>0 and diff1[2]>0 and diff1[3]>0 and diff1[4]>0 and diff1[5]>0 and diff1[6]>0 and diff1[7]<0){FLAG11=CurrentBar;}
    IF(diff1<0 and diff1[1]<0 and diff1[2]<0 and diff1[3]<0 and diff1[4]<0 and diff1[5]<0 and diff1[6]<0 and diff1[7]>0){FLAG22=CurrentBar;}
    y=FLAG11-FLAG22;
    LL=Lowest (L[1],Y+7);
    IF(diff1>0 and diff1[1]>0 and diff1[2]>0 and diff1[3]>0 and diff1[4]>0 and diff1[5]>0 and diff1[6]>0 and diff1[7]<0){LL1=LL;}Else{LL1=LL1[1];}
    IF(LL1[1]<LL1[2]){LLL=LL1[1];}
    IF(LL1<>LL1[1]){LLHB=CurrentBar;}Else{LLHB=LLHB[1];}
    LLH=Highest(H[1],CurrentBar[1]-LLHB+7);
    PlotNumeric("LLH",LLH);
    PlotNumeric("HHL",HHL);

    ZD1=Diff0>=0 and MA[1]<=HH1 and L[2]<=HH1 and H>HH1;
    ZD2=Diff0>=0 and MA[1]>=HH1 and L[2]<=HH1 and H>MA[1];
    ZD3=Diff0>=0 and MA[1]>=HHH and L[2]<=HHH and H>MA[1];
    ZD4=Diff0>=0 and MA[1]<=HHH and L[2]<=HHH and H>HHH;


    ZK1=Diff0<=0 and MA[1]>=LL1 and H[2]>=LL1 and L<LL1;
    ZK2=Diff0<=0 and MA[1]<=LL1 and H[2]>=LL1 and L<MA[1];
    ZK3=Diff0<=0 and MA[1]<=LLL and H[2]>=LLL and L<MA[1];
    ZK4=Diff0<=0 and MA[1]>=LLL and H[2]>=LLL and L<LLL;


    PD1=L>=EntryPrice and LLH<MA[1] and H[1]>=LL1 and L<LL1;


    PK1=H<=EntryPrice and HHL>MA[1] and L[1]<=HH1 and H>HH1;


    ? ? ? ? If (validTime=True and MarketPosition<>1 and CurrentBar>=1)
    ? ? ? ? {
    ? ? ? ? If( ZD1){myPrice = Max (HH1,open);myPrice = IIF (BarStatus==2,0,myPrice);Buy(Lots,myPrice);}
    Else If ( ZD4){myPrice = Max (HHH,open);myPrice = IIF (BarStatus==2,0,myPrice);Buy(Lots,myPrice);}
    Else If (ZD2 OR ZD3){myPrice = Max (MA[1],open);myPrice = IIF (BarStatus==2,0,myPrice);Buy(Lots,myPrice);}
    }//開多

    IF (validTime=True AND MarketPosition<>-1 and CurrentBar>=1)
    {
    If (ZK1){myPrice = Min(LL1,open);myPrice = IIF (BarStatus==2,0,myPrice);SellShort(Lots,myPrice);}
    ? ? ? ???Else If (ZK4){myPrice = Min (LLL,open);myPrice = IIF (BarStatus==2,0,myPrice);SellShort(Lots,myPrice);}
    ? ? ? ???Else If (ZK2 OR ZK3){myPrice = Min (MA[1],open);myPrice = IIF (BarStatus==2,0,myPrice);SellShort(Lots,myPrice);}
    ? ? ? ? }//開空倉
    ? ? ? ???
    ? ? ? ???
    ? ? ? ? If (validTime=True AND MarketPosition==1 and BarsSinceLastEntry >= 1 )
    {
    ? ? ? ? If(PD1){Sell(0,Min(LL1,Open));}
    ? ? ? ? }//平多
    ? ? ? ???
    ? ? ? ? If (validTime=True AND MarketPosition==-1 and BarsSinceLastEntry >= 1 )
    ? ? ? ? {
    ? ? ? ? If(PK1){BuyToCover(0,Max(HH1,Open));}
    }//平
    ? ? ? ???
    ? ? ? ???
    ? ? ? ???
    }

    ?

  • TB客服: 發不出來圖,就描述一下。我的想法是:平多條件是LLH小于ma時才能平多,平空的條件是HHL大于ma時才能平空,但是在圖表上看這個條件沒起作用,不知道是怎么回事。特在此請教。

    ?

  • 網友回復:
    armyhuan 發表于 2019-11-4 09:06
    發不出來圖,就描述一下。我的想法是:平多條件是LLH小于ma時才能平多,平空的條件是HHL大于ma時才能平空, ...

    代碼有誤吧?
    條件中應該寫為validtime==true吧? 判斷式是雙等號。

 

有思路,想編寫各種指標公式,交易模型,選股公式,還原公式的朋友

可聯系技術人員 QQ: 262069696  點擊在線交流或微信號:cxh99cxh99  進行 有償收費 編寫!

怎么收費,代編流程等詳情請點擊閱讀!

(注:由于人數限制,QQ或微信請選擇方便的一個聯系我們就行,加好友時請簡單備注下您的需求,否則無法通過。謝謝您!)


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 国产精品成人一区二区不卡 | 久久久久久久久性潮 | 四虎在线免费播放 | 国产欧美另类性视频 | 国产精品19p | 色综合久久天天影视网 | 2046影院视频大全在线观看 | 亚洲欧美在线视频免费 | 久久久久久久久久免观看 | 再猛点深使劲爽日本免费视频 | 狠狠2020 | 九九99香蕉在线视频网站 | 日本一级毛片一级裸片 | 日韩一区二区天海翼 | 一级特黄aaa大片大全 | 婷婷婷色| 国产合集福利视频在线视频 | 成人亚洲欧美综合 | 久久精品视频大全 | 色综合视频一区二区三区 | 91精品日本久久久久久牛牛 | a毛片免费播放全部完整 | 久久久99精品久久久 | 麻豆国产原创最新在线视频 | 国产精品日本一区二区不卡视频 | 免费中文字幕在线 | 日韩色区| 99热精品成人免费观看 | 国产伦精品一区三区视频 | 性一级视频 | 天堂一区二区三区精品 | 国产精品亚洲二线在线播放 | 四虎永久在线精品视频免费观看 | 久久久久久毛片免费播放 | 久久九色综合九色99伊人 | 99爱在线精品视频免费观看9 | 看片一区 | 免费看欧美一级特黄a大片一 | 精品伊人久久 | 这里只有精品久久 | 四虎精品永久在线网址 |