|
Description |
If() conditionally executes instructions. |
|
|
Syntax |
|
|
|
Parameters |
condition The condition is a numeric expression that evaluates to true or false. If the condition evaluates to true, the instruction(s) in statements commence.
statements One or more instructions to perform when the condition is true. To write multiple instructions, use a begin/end block.
Use AND or OR to test multiple conditions. |
|
|
Return Value |
NA |
|
|
Examples |
AlarmEval=begin retval = false If IBM > 94 AND IBM.close > IBM.prev then retval = TRUE retval end
This example is designed for use in an alarm. To apply this formula to an alarm, you would enter
AlarmEval
as the alarm's trigger condition.
cHammerForm(symb,barRef)=begin retval = clr_yellow if HammerForm(symb, 0) then begin retval = clr_pink if RealBody($1, 0) < 0 then clr_red else clr_green end end
This example illustrates the use of an if statement in a color rule. |
|
|
Comments |
When executing an if() statement, one or more conditions are tested. If the condition(s) test true, the instructions following the then convention are executed. If the condition(s) test false, the instructions following the else convention are executed. |