ELSIF is a conditional statement in the ProBuilder programming language, used as part of a control flow structure. It allows the programmer to specify a new condition to test, if the previous if condition fails. The ELSIF statement provides a way to check multiple conditions sequentially within the same if statement block.
IF (condition1) THEN
[statements]
ELSIF (condition2) THEN
[statements]
ELSE
[statements]
ENDIF
myDPO = DPO[21](typicalprice)
IF (myDPO < 0) THEN
result = result - 1
ELSIF (myDPO > 0) THEN
result = result + 1
ELSE
result = result
ENDIF
RETURN result
COLOURED(124,252,0)
In this example, the ELSIF statement is used to check if myDPO is greater than 0 after the initial IF condition (myDPO < 0) fails. If myDPO is indeed greater than 0, it increments the result by 1. If neither condition is met, the ELSE part executes, which in this case, leaves the result unchanged.
This structure is particularly useful in scenarios where multiple conditions might dictate different actions or outputs, allowing for clear and organized decision-making processes in trading algorithms.