CONDREF Function

You are here:
< All Topics

Store or lock in the latest value when the condition is met.


Syntax:
CONDREF(Source Value, True Condition)
or
CONDREF(Source Value, True Condition, Source Value, Reset Condition)

set SMA30 = SMA(close,30)
set BuyAmount = CONDREF(Close, Close > SMA30)

or

set SMA30 = SMA(close,30)
set BuyAmount = CONDREF(Close, Close > SMA30, 0 , Close < SMA30)

BuyAmount will be equal to the most recent close if the closing price is more than the SMA. If in the next period the condition is still true, then the value will be replaced by the new closing price. This will continue until the closing price is no longer more than the SMA, and the function will reset the BuyAmount back to zero.

Previous Net Foreign Function
Next BLOCKREF Function
Table of Contents