Navigation: Realtest Script Language > Syntax Element Details >







Multi-Bar Functions


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


WhenTrue(condition, expression, count {0}, nth {1})


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

expression - formula to evaluate when condition is true

count - how many bars back to go (optional)

nth - which instance of condition to use (optional)


If nth is positive, condition is evaluated for the most recent bar and 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 and continue forward in time until the abs(nth) non-zero value is found.

For each bar, condition is evaluated as if that bar were the current bar, i.e. without knowledge of future splits relative to that bar.

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.

Count most be provided if nth is to be provided (use 0 for the default of "all bars").

This function supports ultra-fast one-pass calculation when used in the Data Section without the optional arguments.





Copyright © 2020-2024 Systematic Solutions, LLC