Download MetaTrader 5

Loop with increments > 1 possbile?

To add comments, please log in or register
Do you know that MQL5 can create custom graphical tools?
mar
1146
mar 2013.12.06 08:24 

Hello,

I know from Visual Basic that it is possible to use higher increments than 1. There you can add a "step 5" for an increment of 5 instead of 1. Is that also possible with MQL4? I want to make a for-loop and I need the numbers 10,15,20,25,30,35,40,45,50 in my calculation within the loop. I just wanted to know if I can use them as a loop counter or if I have to use another variable.

Alain Verleyen
Moderator
30752
Alain Verleyen 2013.12.06 08:30  
mar:

Hello,

I know from Visual Basic that it is possible to use higher increments than 1. There you can add a "step 5" for an increment of 5 instead of 1. Is that also possible with MQL4? I want to make a for-loop and I need the numbers 10,15,20,25,30,35,40,45,50 in my calculation within the loop. I just wanted to know if I can use them as a loop counter or if I have to use another variable.


Of course, it's possible.


   for(int i=10 ; i<=50 ; i+=5)
   {
    //...
   }
mar
1146
mar 2013.12.06 08:56  
Thank you !!
To add comments, please log in or register