How Can We Help?
BLOCKREF Function
**Syntax updated in version 1.1**
Similar to the CondRef function but with second condition to reset the value without waiting for the first condition to be true.
Syntax:
BLOCKREF(locked value if Condition 1=True, Condition1, new value if Condition 2=True, Condition2)
Example: If Buy is true, BuyAmount will be equal to value of close at that bar. The value is kept even Buy is no longer true. Value will be only reset by second condition or when first condition will be evaluated to true again. When Sell is True, BuyAmount will be equal to zero.
Set BuyAmount = BLOCKREF(Close,Buy,0,Sell)
–Close– | –Condition 1– | –Condition 2– | –Blockref Value– |
25 | True | False | 25 |
28 | True | False | 25 |
26.5 | True | False | 25 |
30 | False | True | 0 |
28.5 | False | False | 0 |
31 | True | False | 31 |
32.5 | True | False | 31 |