//After CLose time set hard stop losses at last position entry price with Buffer
 override protected bool ExcuteRuleLogic()
 {
     if (BotState.IsAfterCloseTime)
     {
         StopLossManager.SetSLWithBufferForAllPositions(BotState.LastPositionEntryPrice);
         ExecuteOnceOnly();
         return(true);
     }
     return(false);
 }
 //If after reduce risk time then set hard stop losses to Last Profit Positions Entry Price with buffer
 override protected bool ExcuteRuleLogic()
 {
     if (BotState.IsAfterReducedRiskTime)
     {
         if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
         {
             //If Hard SL has not been set yet
             if (BotState.LastProfitPositionClosePrice > 0)
             {
                 StopLossManager.SetSLWithBufferForAllPositions(BotState.LastProfitPositionClosePrice);
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
        // If it is after CloseTime and remaining pending orders have not been closed then close all pending orders
        override protected bool ExcuteRuleLogic()
        {
            if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
            {
                //Calculate spike retrace factor
                SpikeManager.CalculateRetraceFactor();

                if (SpikeManager.IsRetraceGreaterThanLevel3())
                {
                    if (BotState.LastProfitPositionClosePrice > 0)
                    {
                        StopLossManager.SetSLWithBufferForAllPositions(BotState.LastProfitPositionClosePrice);
                        return(true);
                    }
                }
            }
            return(false);
        }
        //If Spike retrace is greater than Level 1 but less than Level 2 set SL to last profit position entry price plus buffer
        override protected bool ExcuteRuleLogic()
        {
            if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
            {
                //Calculate spike retrace factor
                SpikeManager.CalculateRetraceFactor();

                //Set hard stop losses and activate Trail if Spike has retraced between than retraceLevel1 and retraceLevel2
                if (SpikeManager.IsRetraceBetweenLevel1AndLevel2())
                {
                    //If Hard SL has not been set yet
                    if (BotState.LastProfitPositionEntryPrice > 0)
                    {
                        StopLossManager.SetSLWithBufferForAllPositions(BotState.LastProfitPositionEntryPrice);
                        return(true);
                    }
                }
            }
            return(false);
        }