コード例 #1
0
 //If trades still open at Terminate Time then take the hit and close remaining positions
 override protected bool ExcuteRuleLogic()
 {
     if (BotState.IsAfterTerminateTime)
     {
         PositionsManager.CloseAllPositions();
         BotState.IsReset = true;
         return(true);
     }
     return(false);
 }
 //Last position's SL has been triggered for a loss - CLOSING ALL POSITIONS
 override protected void Execute(Position position)
 {
     if (BotState.IsThisBotId(position.Label))
     {
         if (BotState.LastPositionLabel == position.Label && position.GrossProfit < 0)
         {
             BuyLimitOrdersTrader.CancelAllPendingOrders();
             PositionsManager.CloseAllPositions();
             BotState.IsReset = true;
             ExecuteOnceOnly();
         }
     }
 }