I have been looking at doing backtesting on stocks when the index prices are extended from their moving average, but only when the index is in a bullish condition.
It seems the script below is only isolating when the index is in its trending mode and not considering the price extension.
What’s the best way to think about how to get a state condition to work with a CrossesAbove / Below variable?
The Switch function is either on or off, so it can only have two states. To have a 3rd might be accomplished with a nested IF statement. What’s the formula for the NDX 10 Day MA Extension script?