THEN is a crucial keyword in the ProBuilder language, primarily used within an IF statement to specify the block of code that should execute when the preceding condition is true. It acts as a bridge between the condition and the actions that should follow if the condition holds.
Syntax:
IF condition THEN
// Code to execute if condition is true
ENDIF
Example:
IF Close > Open THEN
DRAWARROWUP(barindex, low) COLOURED(0, 255, 0)
ENDIF
In this example, if the closing price of a bar is greater than its opening price, an upward green arrow is drawn at the low of the bar. This visual indicator can help in identifying potential bullish patterns.
- The THEN keyword must always follow a condition within an
IFstatement. - It is followed by one or more actions or statements that are executed only if the condition evaluates to true.
- Every
THENmust be paired with anENDIFto properly close the conditional statement.
This keyword is fundamental in creating conditional logic in ProBuilder scripts, allowing for dynamic and responsive indicator and trading strategy development.