Setup within the next 40 bars
-
Hi, how do I do this? I have a condition and once it's met, a second condition has to be met within 40 bars or the whole setup is invalid. Any suggestions? Thanks in advance.
-
Also I would like to know how to do this is in a easy way: I want a condition the says "in the last 40 bars at least once a candle crossed and closed beyond the 10 and 15 EMA." How do I do that?
-
@sirluk Set a flag to true on 1st condition, set to false after 40 bars, use once per bar with a formula adding +1 every bar, reset to 0 when 1st condition met, check flag before buy/sell.
-
Thanks @jstap, this part worked fine. Any suggestions about my second question with the 10 and 15 EMA?
-
@sirluk This loop will count candles above/below MA, change the value in the modify block to start at a further candle, you will then have to work out what you do when a candle crosses.
-
Thanks, I'll have a look if I can work it out.