Hello,
Hope you are doing well.
I want to define a trailing stop loss based on the outside and inside candles.
Inside candle: the close price of the candle is within the range of the former candle
Outside candle: the close price is higher than the high of the former candle (when it is a buy signal) or lower than the low of the former candle (when it is a short signal)
Suppose the trading system provides the buy and sell signals (like the crossover of the MAs) and stop loss is 20 pips lower than the low of the entry candle. Then, If the next candle is an outside candle, the stop will be 20 pips lower/higher than the low of the new candle (in a buy/sell signal). The outside candle should be stored because the following candles should be compared with that. There might be more than one inside candle. Otherwise (if the candle is an inside candle), there is no change in the stop loss. I would appreciate it if you could help me with this code.
Thanks a million for your help in advance.
Best regards,