您现在的位置:程序化交易>> 期货公式>> 交易开拓者(TB)>> 开拓者公式>>正文内容

突破昨天最高价最低价今天开盘价运算出的上下轨日内交易策略[开拓者公式]

突破昨天最高价最低价今天开盘价运算出的上下轨日内交易策略

源码:

Params
      Numeric PercentOfRange(0.8);//突破参数N
      Numeric ExitOnCloseMins(14.55);//平仓时间
      Numeric MinRange(0.2);//最小Range
      Numeric LastTradeMins(14.00);//最后交易时间
      Numeric BeginTradeMins(9.00);
      Numeric Lots(1);
      Numeric Stoplossset(1);
Vars
      NumericSeries DayOpen;
      NumericSeries preDayRange;
      NumericSeries HigherAfterEntry;
      NumericSeries LowerAfterEntry;
      Numeric preDayHigh;
      Numeric preDayLow;
      Numeric UpperBand;
      Numeric LowerBand;
      Numeric MyPrice;
      Numeric StopLine;
Begin
      DayOpen=OpenD(0);
      preDayHigh=HighD(1);
      preDayLow=LowD(1);
      preDayRange=HighD(1)-LowD(1);
      UpperBand=DayOpen+preDayRange*PercentOfRange;
      LowerBand=Dayopen-preDayRange*PercentOfRange;
     If(BarsSinceEntry==1)
     {
         HigherAfterEntry=AvgEntryPrice;
         LowerAfterEntry=HigherAfterEntry;
      }Else If(BarsSinceEntry>1)
     {
          HigherAfterEntry=max (HigherAfterEntry[1],High[1]);
          LowerAfterEntry=min(LowerAfterEntry[1],Low[1]);
     }// www.cxh99.com
     If(Date!=Date[1])
     {DayOpen=Open;
      preDayRange=preDayHigh-preDayLow;
      If(preDayRange<Open*MinRange*0.01)
         PreDayRange=Open*MinRange*0.01;
      }Else
      {
       DayOpen=DayOpen[1];
       preDayRange=preDayRange[1];
       }
     If(MarketPosition!=1&&High>=UpperBand&&Time<LastTradeMins/100)
     {
              Myprice=UpperBand;
              If(Open>Myprice)Myprice=Open;
              Buy(1,Myprice);
              Return;
      }
      If(MarketPosition!=1&&Low<=LowerBand&&Time<LastTradeMins/100)
     {
              Myprice=LowerBand;
              If(Open<Myprice)Myprice=Open;
              Sellshort(1,Myprice);
              Return;
      }
      If(MarketPosition==1)
      {
           
             StopLine=UpperBand-DayOpen*StopLossSet*0.01;
             If(Low<=StopLine)
             {
                  MyPrice=StopLine;
                  If(Open<MyPrice)MyPrice=Open;
                  BuyToCover(Lots,MyPrice);
              }
       }
     
      //收盘平仓
      If(Time>=ExitOnCloseMins/100)
      {
               Sell(1,Open);
               BuyToCover(1,Open);
       }
       SetExitOncLOSE;
End
 

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!

 


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容