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".

Don't buy if there are any nearby orders closed

Sep 17, 2021 - 2:25 PM

Viewed 445 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/26131 COPY
  • 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!

    Screenshot 2021-09-17 14.15.01.png

    0
  • 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, ...) 
    
    0
CONTENTS