Difference between revisions of "Else"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
Used in combination with [[If]] and [[Then]] to form a conditional statement that executes specific instructions if a logical expression is false. | Used in combination with [[If]] and [[Then]] to form a conditional statement that executes specific instructions if a logical expression is false. | ||
− | The conditional execution statement must contain both [[If]] and [[Then]] in addition to [[Else | + | The conditional execution statement must contain both [[If]] and [[Then]] in addition to [[Else]]. |
− | + | == Usage == | |
− | |||
− | |||
<syntaxhighlight>If E Then I1 Else I2</syntaxhighlight> | <syntaxhighlight>If E Then I1 Else I2</syntaxhighlight> | ||
− | Where: | + | Where: |
+ | |||
+ | :'''E''' - a true/false expression. | ||
+ | |||
+ | :'''I''' - conditional instructions. | ||
− | [[ | + | == Notes == |
+ | * For more information see [[If]]. | ||
− | + | == Example == | |
− | If | + | If ''UpTrend'' is true then buy and if ''UpTrend'' is false then sell short: |
− | |||
− | |||
+ | <syntaxhighlight>If UpTrend = True Then | ||
+ | Buy Next Bar Market | ||
+ | Else | ||
+ | SellShort Next Bar Market;</syntaxhighlight> | ||
[[Category:Comparisons and Loops]] | [[Category:Comparisons and Loops]] |
Latest revision as of 10:55, 19 February 2012
Used in combination with If and Then to form a conditional statement that executes specific instructions if a logical expression is false.
The conditional execution statement must contain both If and Then in addition to Else.
Usage
If E Then I1 Else I2
Where:
- E - a true/false expression.
- I - conditional instructions.
Notes
- For more information see If.
Example
If UpTrend is true then buy and if UpTrend is false then sell short:
If UpTrend = True Then
Buy Next Bar Market
Else
SellShort Next Bar Market;