How do I tell my script not to buy if there has been a closed trade in the previous 5 candles?
In attach the an wrong entry
example!
Welcome to the BEST forum for traders
Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".
How do I tell my script not to buy if there has been a closed trade in the previous 5 candles?
In attach the an wrong entry
example!
Hi @carlopierri
Save the exit conditions (SL, TP, custom close) in a consolidated exit variable
exit_bull_cond = exit_bull_SL or exit_bull_TP or exit_bull_custom
And then use the barssince function
skip_condition = barssince(exit_bull_cond) <= 5
if not skip_condition // there was a close trade after 5 candles
// strategy.entry("Long", true, ...)