4 candle rule
-
hi, i need help to solve this problem that 1st indicator crossed 0 line 4 candles before and to take trade 2nd indicator should cross in 4 candles or just pass
-
@raja0033 I'm afraid I don't fully understand what you mean. Can you please provide some more detailed info of the problem?
-
Hey i will try to explain more, so in this situation i have two indicators, so let's say that i only make the trade when both indicators give me signal.first indicator gave me signal today for trade but 2nd indicator didn't. But i can wait only four candles after the 1st indicator gave me signal if in those 4 candles 2nd indicator gave me signal i trade otherwise not.
-
@raja0033 Ok. You can create a boolean variable that will change from false to true , for example, when the first condition is true. Then you can use a second variable counting candles after the boolean variable is changed. That counting variable will be modified with a 'once per bar' block on top. That's a way to do it.
-
@l-andorrà Hi, would this be a related solution to my post here https://fxdreema.com/forum/topic/11304/candle-id-range ? Would the same concept work here in some way? Thanks.
-
@dre No. You are lookng for a crossing to happen somewhere in the past, whereas is wants to stop a second condition to be checked after some bars passed.
-
@l-andorrà thanks but can you show me a demo, really appreciate this
-
@raja0033 This is an example with MACD and two crossing MA:

The block on top is looking for MACD to cross up 0 at any moment in the previous 4 candles. ANd only when that is true, the second crossing block below will be checked. Only when both condition are true, a 'buy now' block can be added below it.