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

标题: 公式导入 数据回测不了?哪位老师能看下 [打印本页]

作者: yaogexigua    时间: 2016-11-21 21:01:43     标题: 公式导入 数据回测不了?哪位老师能看下

Params
   Numeric length(14);
   Numeric OverSold(20);
   Numeric OverBought(80);
Vars
   NumericSeries WRValue;
   Bool Con1;
   Bool Con2;
   Numeric StopLossSet(20);  
   Numeric MinPoint;
   Numeric MyExitPrice;
   Numeric MyEntryPrice;
Begin
   If(!CallAuctionFilter())Return;
   WRValue=PercentR(length);
   PlotNumeric("WR",WRValue);
   PlotNumeric("超卖",OverBought);
   PlotNumeric("超买",OverSold);
   MinPoint=MinMove*PriceScale;
   Con1=CrossOver(WRValue[1],OverBought);
   Con2=CrossUnder(WRValue[1],OverSold);
   If(Con1 And MarketPosition==0 And Vol>0)
      {
            SellShort(1,Open);
                MyEntryPrice=Open;
                If(High>MyEntryPrice+StopLossSet*MinPoint)
                   {
                     MyExitPrice=MyEntryPrice+StopLossSet*MinPoint;
                         If(Open>MyExitPrice)MyExitPrice=Open;
                           BuyToCover(1,MyExitPrice);
            }
                If(Con2 And MarketPosition==1 And Vol>0)
                   BuyToCover(1,Open);
                }

       Else If(Con2 And MarketPosition==0 And Vol>0)
              {
                     Buy(1,Open);
                         MyEntryPrice=Open;
            If(Low<MyEntryPrice-StopLossSet*MinPoint)
                      {
                              MyExitPrice=MyEntryPrice-StopLossSet*MinPoint;
                                   If(Open<MyExitPrice)MyExitPrice=Open;
                                   Sell(1,MyExitPrice);
                                }
                        If(Con1 And MarketPosition==1 And Vol>0)
                               Sell(1,Open);
                        }
        End




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