Changes
DownTo
,Created page with "Used in combination with For to form a loop statement that will execute a set of instructions repeatedly until the loop count reaches the specified final value. [[DownTo]..."
Used in combination with [[For]] to form a loop statement that will execute a set of instructions repeatedly until the loop count reaches the specified final value.
[[DownTo]] specifies that the value of the counter variable is to be decreased by one on the completion of each loop.
For more information see [[For.]]
==== Usage ====
<syntaxhighlight>For Counter=IValue DownTo FValue Begin
I1;
I2;
End;</syntaxhighlight>
Where: [[Counter]] - a numerical variable used store the loop count
[[IValue]] - a numerical expression specifying the initial counter value
[[FValue]] - a numerical expression specifying the final counter value
==== Example ====
Add the high prices of the last 10 bars to the [[HighPriceSum]] variable:
<syntaxhighlight>For BarBackNo=9 DownTo 0 Begin
HighPriceSum=HighPriceSum+High[BarBackNo];
End;</syntaxhighlight>
[[Category:Comparisons and Loops]]
[[DownTo]] specifies that the value of the counter variable is to be decreased by one on the completion of each loop.
For more information see [[For.]]
==== Usage ====
<syntaxhighlight>For Counter=IValue DownTo FValue Begin
I1;
I2;
End;</syntaxhighlight>
Where: [[Counter]] - a numerical variable used store the loop count
[[IValue]] - a numerical expression specifying the initial counter value
[[FValue]] - a numerical expression specifying the final counter value
==== Example ====
Add the high prices of the last 10 bars to the [[HighPriceSum]] variable:
<syntaxhighlight>For BarBackNo=9 DownTo 0 Begin
HighPriceSum=HighPriceSum+High[BarBackNo];
End;</syntaxhighlight>
[[Category:Comparisons and Loops]]