How to determine if a condition occurred over the last x bars?

Anytime you want to determine if a condition happened over the last X bars, you can use the Max indicator (in the basic category).

So for instance if you have a condition (like gap up/down a certain percentage) which is 0 if false or 1 if true, then using Max(condition, 90) will return a 1 if the condition occurred anytime over the last 90 bars and return a 0 if the condition did not occur over the last 90 bars.

Click here to download an example chart.

Was this article helpful?

Related Articles