Once the higher timeframe achieves <this status>,
enter a trade at the first instance of the lower timeframe achieving <this other status>,
even if it takes more than a few lower timeframe bars to do it.
The problem I'm incurring is that most of the time, by the time the lower timeframe achieves <this other status>, the higher timeframe <this status> is no longer true. So I can't use logic that combines the two with "&&" statements. And once I make it complex and use "||" conditions (if lower timeframe is <this other status> and either higher timeframe bar [0] or [1] or [2] is <this status>), things start to degrade because the logic is so wide open.
Is there a way to "turn on" a flag (based on higher timeframe conditions) that lasts until the lower timeframe turns it off, either through a trade or when the conditions no longer merit it? Sort of like "if the lower timeframe achieves <this other status>, enter long only if the higher timeframe has indicated that you have the green light". I feel like it should be obvious, but I'm not sure I understand the code looping cycle when it comes to maintaining local values after the next bar opens (because of CalculateOnBarClose).
Thanks in advance,
Gary
Comment