×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

To - MultiCharts
Open main menu

To

Revision as of 11:12, 19 February 2012 by JoshM (talk | contribs) (→‎Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

To specifies that the value of the counter variable is to be increased by one on the completion of each loop.

Usage

For Counter=IValue To FValue Begin
  I1;
  I2;
End;

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.

Notes

  • For more information see For.
  • See DownTo for decreasing the counter variable for one completion of the loop.
  • It's not needed to increase the counter variable yourself - that is done by PowerLanguage.

Example

Add the high prices of the last 10 bars to the HighPriceSum variable:

For BarBackNo = 0 To 9 Begin

  HighPriceSum = HighPriceSum + High[BarBackNo];

End;