End: Difference between revisions
From MultiCharts
no edit summary
(Created page with "Used in combination with Begin to group instructions for conditional execution; an End must always be preceded by a Begin. Begin and End can be used with [...") |
No edit summary |
||
Line 1: | Line 1: | ||
Used in combination with [[Begin]] to group instructions for conditional execution; an [[End]] must always be preceded by a [[Begin | Used in combination with [[Begin]] to group instructions for conditional execution; an [[End]] must always be preceded by a [[Begin]]. | ||
== Usage == | |||
<syntaxhighlight>CS Begin | <syntaxhighlight>CS Begin | ||
I1; | I1; | ||
I2; | I2; | ||
I3; | I3; | ||
End;</syntaxhighlight> | End;</syntaxhighlight> | ||
Where: | Where: | ||
:'''C''' - conditional statement. | |||
:'''I''' - conditional instructions. | |||
== | == Notes == | ||
* [[Begin]] and [[End]] can be used with [[Then]], [[Else]], [[For]], and [[While]] conditional statements. | |||
* Only the last instance of [[End]] within the same conditional execution statement should be followed by a semicolon (;). | |||
<syntaxhighlight>If UpTrend Then Begin | == Example == | ||
Buy Next Bar Market; | If ''UpTrend'' is true then buy, otherwise sell short: | ||
<syntaxhighlight>If UpTrend = True Then Begin | |||
Buy Next Bar Market; | |||
End | End | ||
Else Begin | Else Begin | ||
SellShort Next Bar Market; | SellShort Next Bar Market; | ||
End;</syntaxhighlight> | End;</syntaxhighlight> | ||
[[Category:Comparisons and Loops]] | [[Category:Comparisons and Loops]] |