Multi-Bar Functions


Evaluates an expression for a past (or future) bar when a condition was (or will be) true


WhenTrue(condition, expression, nth {1})


condition - formula to evaluate for each bar until true (non-zero)

expression - formula to evaluate when condition is true

nth - which instance of condition to use (optional)


If nth is positive, condition is evaluated for the most recent bar then continue back in time until the nth non-zero value is found.

If nth is negative, condition will be evaluated for the most recent bar then continue forward in time until the abs(nth) non-zero value is found.

When the specified nth condition is found, expression is then evaluated for that bar and the resulting value is returned.

If condition is never found, the result is NaN.

If nth is not specified, the default is 1.





Copyright © 2020-2021 Systematic Solutions, LLC