Dear all
Would you please tell me how to fix it?
Read the documentation about for loops . . .
Expression1; while(Expression2) { operator; Expression3; };
int k2=10000, k3=1000, TimeFrame2=60; int i = 10000; while(i > 1000) { Alert("i= "+i); i - 60 * 60; // what does this do ? ? did you mean i -= TimeFrame2 * 60 ? }
what result did you expected ???
it should issue alert message on screen:
i= 10000
i= 6400
i= 2800
i= -800
Read the documentation about for loops . . .
Expression1; while(Expression2) { operator; Expression3; };
I did read the document.
my problem is, when I compile it, "it seems" editor only allow coders to use i-- or i++ in expression 3. Even I used "i-2", it didn't accept.
I would like to know if my observation is true or I miss something in the rule.
it should issue alert message on screen:
i= 10000
i= 6400
i= 2800
i= -800
for( int i=10000; i>1000; i=i-60*60 ) { Alert("i= "+i); }
will give outcome 10000 6400 and 2800
not -800 because it is lower then 1000
to get your result ......
for( int i=10000; i>1000; i=i-60*60 ) { Alert("i= "+i); } Alert("last alert i= "+i);
or like
int i = 10000; Alert("i= "+i); while(i > 1000) { i=i - 60 * 60; Alert("i= "+i); }
you can write it this way
will give outcome 10000 6400 and 2800
not -800 because it is lower then 1000
ok, I get it!
thank you so much!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all
Would you please tell me how to fix it?
Thanks a lot!
wing