开拓者期货期权程序化系统交易论坛

标题: 模型提示return返回类型不对 [打印本页]

作者: leoruin13    时间: 2017-3-1 17:25:36     标题: 模型提示return返回类型不对

Params
Numeric K1(0.5);
Numeric K2(0.5);
Numeric Mday(1);
Numeric Nday(1);
Numeric lots(1);
Numeric offset(0);

Vars
Numeric BuyRange(0);
Numeric SellRange(0);
Numeric BuyTrig(0);
Numeric SellTrig(0);
Numeric HH;
Numeric LL;
Numeric HC;
Numeric LC;
Numeric i_offset;
Numeric BuyPosition;
Numeric SellPosition;

Begin  
     
     i_offset=offset*MinMove*PriceScale;
     HH=Highest(HighD(1),Mday);
     HC=Highest(CloseD(1),Mday);
     LL=Lowest(LowD(1),Mday);
     LC=Lowest(CloseD(1),Mday);
//计算BuyRange和SellRange
     if((HH-LC)>=(HC-LL))
   {
              SellRange=HH-LC;
   
    }
        Else
   {
              SellRange=HH-LL;
    }

     HH=Highest(HighD(1),Nday);
     HC=Highest(CloseD(1),Nday);
     LL=Lowest(LowD(1),Nday);
     LC=Lowest(CloseD(1),Nday);
    if((HH-LC)>=(HC-LL))
   {
              BuyRange=HH-LC;
   
    }Else
   {
              BuyRange=HH-LL;
    }
//计算通道上下轨
    BuyTrig=K1*BuyRange;
    SellTrig=K2*SellRange;

    BuyPosition=OpenD(0)+BuyTrig;
    SellPosition=OpenD(0)+SellTrig;
    PlotNumeric("BuyPosition",BuyPosition);
    PlotNumeric("SellPosition",SellPosition);
//入场条件:突破上轨反手多,突破下轨反手空
    if(MarketPosition==0)

   {
             if(high>=BuyPosition)
            {
                     Buy(lots,Max(Open,BuyPosition)+i_offset);
                                         Return;
             }
             if(Low<=SellPosition)
            {
                     SellShort(lots,Min(Open,SellPosition)-i_offset);
                                         Return;
             }
    }
    if(MarketPosition==1)
   {
             if(Low<=SellPosition)
            {
                    SellShort(lots,Min(Open,SellPosition)-i_offset);
                    Return;
             }
    }
End




欢迎光临 开拓者期货期权程序化系统交易论坛 (http://bbs.tb18.net/) Powered by Discuz! X2