General objective: I request the modification of the current code. Particular objective: I want the stop loss to be modified when the trend applies (bullish or bearish as appropriate). The trend can change at any time, so I want the stop loss to be changed if the corresponding trend applies when the position is opened or changed later. There is already a stop loss modification in the trailing stop formulated for buy and sell positions, I want it to be maintained. If you apply the trailing stop you should not further analyze whether you should apply the trend stop loss. Calculation: TREND CALCULATION: double array_hull_tend[]; CopyBuffer(handle_hull_tendency, 0, 0, 2, array_hull_tend); ArraySetAsSeries(array_hull_tend, true); double tendencia; if (array_hull_tend[0] > array_hull_tend[1]) { tendencia = 1; // uptrend } else if (array_hull_tend[0] < array_hull_tend[1]) { tendencia = -1; // downtrend } else { tendencia = 0; // Neutral trend (optional) } For BUY ModifyTrade StopLoss BUY (posTicketCompra): IF tendencia = -1 SymbolInfoDouble(Symbol(), SYMBOL_BID) - 100 * _Point For SELL ModifyTrade StopLoss SELL (posTicketVenta): IF tendencia = 1 SymbolInfoDouble(Symbol(), SYMBOL_ASK) + 100 * _Point Aditionaly: Add robot operating hours. Opening and closing hours. It must be possible to modify the schedule from the platform parameters.