如何启用即时行情模式(平台设置)

如何启用即时行情模式(平台设置);我的代码要在集合竟价时段下单。

Params

   Numeric StartTime(925);   // 9:25

   Numeric jEndTime(929);    // 9:29


Vars

   Bool LockPositionSent(False);

   Numeric CurrentHHMM;

   Numeric LastPrice;

   Numeric Upper;

   Numeric Lower;


Events


OnBar(ArrayRef<Integer> indexs)

{

   // 添加调试信息,确认事件触发时间

   // Print("OnBar触发于:", Text(Time));

   

   CurrentHHMM = Hour * 100 + Minute;

   

   // 9:30后重置标记

   if (CurrentHHMM > 930)

   {

       LockPositionSent = False;

       return;

   }

   

   // 仅在9:25-9:29区间处理锁仓平单

   if (CurrentHHMM >= StartTime && CurrentHHMM <= jEndTime)

   {

       // 添加持仓信息打印

       // Print("当前持仓 - 多仓:", A_BuyPosition, " 空仓:", A_SellPosition);

       

       if (A_BuyPosition > 0 && A_SellPosition > 0 && !LockPositionSent)

       {

           // 获取价格

           LastPrice = Close;

           Upper = Q_UpperLimit;

           Lower = Q_LowerLimit;

           

           // 确保价格在涨跌停范围内

           if (Upper > 0 && Lower > 0)

           {

               // 添加价格验证

               if (LastPrice < Lower) LastPrice = Lower;

               if (LastPrice > Upper) LastPrice = Upper;

           }

           

           // 平多仓

           Numeric orderRef1 = A_SendOrder(Enum_Sell, Enum_Exit, A_BuyPosition, LastPrice);

           if (orderRef1 < 0)

               Print("平多仓失败! 错误:", GetLastError);

           

           // 平空仓

           Numeric orderRef2 = A_SendOrder(Enum_Buy, Enum_Exit, A_SellPosition, LastPrice);

           if (orderRef2 < 0)

               Print("平空仓失败! 错误:", GetLastError);

           

           LockPositionSent = True;

           

           // 添加交易确认信息

           Commentary("锁仓平单已发送 | 时间:", Text(CurrentHHMM),

                     " | 价格:", Text(LastPrice),

                     " | 多仓:", Text(A_BuyPosition),

                     " | 空仓:", Text(A_SellPosition));

       }

   }

}如何启用即时行情模式(平台设置)?

无图表交易模式下如何设置跨周期策略?
如何观察到小周期的即时净值曲线?
启用开平互转是什么意思
行情报价->模型运行->无法选择自定义生成的模式,包含导入的官方模式
行情连接总是断开&&线程设置
如何开始平台的自动交易
如何知道一个函数是属于图表模式还是交易等其他模式?
请问,模式策略如何与手工单同步
启用算法代理,如何调整头寸,才不受影响?
请问股票交易的设置应该如何设置