收盘前平仓、延时开仓(代码共享)

实现收盘前平仓、开盘后延时开仓(代码共享)

Params

Numeric ExitCloseSecs(300);  //收盘前N秒离场(300秒)

Numeric OpenCloseSecs(300);         //开盘后N秒交易(300秒)

Vars

Bool EntryTrading; //判断开仓时间段

Bool ExitUnTrading; //判断平仓时间段

OnBar(ArrayRef<Integer> indexs)

   {

//开盘前延时开仓时间

EntryTrading =  DateTimeDiff(Date+Time,TradingCloseDateTime(Symbol, Date+Time)) < OpenCloseSecs;

//收盘前平仓时间

ExitUnTrading = DateTimeDiff(Date+Time,TradingCloseDateTime(Symbol, Date+Time)) < ExitCloseSecs;

//延时开仓

   If (ExitUnTrading == False )

      {

      buy(1,0)

     Commentary("开盘延时开仓");

      }

//收盘时间平仓  

If( ExitUnTrading)

{

Sell(0 , 0);

Commentary("收盘平仓");

}

}

日线收盘前平仓
收盘前平仓
收盘前1分钟平仓
请问日内交易收盘前两K不开仓怎么写?
不同周期收盘前,平仓
收盘前平仓, 信号闪烁
夜盘收盘平仓代码
日线回测中如何在收盘前10分钟平仓,请问代码如何写?
前一根收盘价加1,代码怎么写。
请教如何写延时1秒发平仓单,谢谢。

你有什么问题吗