TBQ3中SetTriggerBarClose-设置触发OnBarClose的时间点不执行

我在tbq3中用SetTriggerBarClose设置触发OnBarClose的时间点,但是没有执行,同样的程序在TBQuant中是可以执行的。

代码如下,请帮我分析一下问题出在哪里

Params

   Numeric Length(20);                     // 均线周期

   Numeric Lots(1);                        // 开仓手数

   Numeric Loss(30);                       // 止损跳数

   Numeric advancesec(5);                  // 提前多少秒


Vars

   Series<Numeric> minPoint;            // 一跳

   Series<Numeric> lossPrice;           // 止损价格

   Series<Numeric> winPrice;            // 止盈价格

   Plot plt_losswin;

   

   Series<Numeric> MA;


Defs

   //此处添加公式函数

   

Events

   //此处实现事件函数

   

   //初始化事件函数,策略运行期间,首先运行且只有一次

   OnInit()

   {

       //止盈止损线划线无数据间断设置

       plt_losswin.setOption("止损线","line-display","interval");

       plt_losswin.setOption("止盈线","line-display","interval");

       //plt_losswin.setOption("止盈线","color",Red);

       //plt_losswin.setOption("止损线","color",Green);

   }

   

   //每根BAR开始的时候设置触发时间点

   OnReady()

   {

       //Numeric advancesec(5); //提前多少秒

       Array<Numeric> timePoint;

       Numeric ret = DateTimeAdd(RealEndDateTime, -1*advancesec);

       ret = StringToTime(TimeToString(ret));

       Print("endtime="+text(RealEndDateTime)+" SetTriggerBarClose:" + Text(ret));

       ArrayPushBack(timePoint, ret);

       SetTriggerBarClose(timePoint);

   }

   

   OnBarClose(ArrayRef<Integer> indexes)

   {

       Bool condL=Close>=MA And Close[1]<MA[1];

       Bool condS=Close<=MA And Close[1]>MA[1];

       

       If (MarketPosition==0 And condS)

       {

           Commentary("价格下破"+Text(Length)+"均线开空");

           SellShort(Lots,Close);

           If (Loss>0) lossPrice=EntryPrice+Loss*minPoint;

           //If (Win>0) winPrice =EntryPrice-Win*minPoint;

       }

       If (MarketPosition==-1 And condL)

       {

           Commentary("价格上破"+Text(Length)+"均线平空");

           BuyToCover(Lots,Open);

       }

   

   }



   //Bar更新事件函数,参数indexs表示变化的数据源图层ID数组

   OnBar(ArrayRef<Integer> indexs)

   {

       MA=AverageFC(Close,Length);

       PlotNumeric("MA",MA);

   

       minPoint=MinMove()*PriceScale();

       Commentary("该品种1跳等于"+Text(minPoint)+"点");

     

         //空头止损

       If (MarketPosition==-1 And Vol>0 And BarsSinceEntry>0 And High>=lossPrice And lossPrice>0 And Loss>0)

       {

           Commentary("空头固定止损");

           BuyToCover(0,Max(Open,lossPrice));

           lossPrice=0;

           //winPrice=0;.

           //PlotBool("dd",False);

       }


   }


OnBarClose的触发时间和设置的触发时间点不一致
关于 OnBarClose
OnBarClose设置提前触发,有提前触发却没有发出委托
设置收盘时间点为14:59:00,请问onbarclose是从时间点以后每个TICK运行一次还是只在14:59:00运行一次?
OnBarClose里SetTriggerBarClose的设置问题
设置 触发OnBarOpen的时间函数怎么写,请老师给写一个
onbarclose应用实例好像不执行
历史图标上最后一根Bar的OnBarClose不触发且QuoteDataExist值不对
onbarclose为什么会在刚开盘执行
怎么实现每根Bar结束前2秒触发ONbarclose执行

你是怎么得出这个结论的

我无法复现这个结果

你是不是换周期了

通过运行过程中发现收盘前并没有执行。如果这个写法可以的话我再试试