maybe you need this feature
thank you for the link. Now trying to figure out how I can achieve comment uncomment task in mql4 .
Hi is this even possible in mql4 ?
Being able to comment/uncomment lines within the file depending on the result of some lines somewhere within the same file?
for eg:
or How this/similar can be achieved with use of any device like filter , loop etc ?
Thank you.
Thats interesting .
Is "x" a condition that is valid (or not) during runtime or is it checking for the terminal version ?
Thats interesting .
Is "x" a condition that is valid (or not) during runtime or is it checking for the terminal version ?
X is a simple user input value condition. Eg
if ( user_input_mode==1) { comment lines 45-50 ; } else { uncomment lines 25-28 ; }
So these lines can be gated with that check and all it would do is add 4 lines of code ,isn't this reduntant ?
What I am trying to do is . In the following code.
1. if I select TIMEFRAME==1 then last 4 lines to have 'no effect whatsoever' , what I found is even those lines 'just being there messes up' with the normal loop operation, probably because of the first line ie tfs(time frame array) and j+1 < tfs and j+1+1<tfs expressions. All using the same tfs array.. 'Hence the need for commenting ' . those lines just being there even if I don't use them limit the loop operation till j+1+1<tfs when it is supposed to be done till j+1<tfs
2. if I select TIMEFRAME ==2 then those lines are needed . so the 'need for uncommenting'
3.Is it possible to do it some other way? I hope I made some sense above.
for(int j = 0; j<tfs; j++) { int ii = 0; int find = false; for(int i = 0; i< stochs; i++) { int shift = 1; { if(TIMEFRAME==1)// user choice for match for j and j+1 timeframe sub2 = (j+1<tfs); else sub2= (j+1<tfs)&& (j+1+1<tfs) ; if(sub2) { double mv0 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift); double sv0 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift); double mv1 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift+1); double sv1 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift+1); double mv10 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift); double sv10 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift); double mv11 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift+1); double sv11 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift+1); double mv110 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift); double sv110 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift); double mv111 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift+1); double sv111 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift+1);
maybe you need this feature
why not gate the 4 last lines again with if(TIMEFRAME!=1){ 4lines; } ?
why not gate the 4 last lines again with if(TIMEFRAME!=1){ 4lines; } ?
When I did that as below now line at the bottom if((sv1 >= mv1 && sv0 < mv0) && (sv11 >= mv11 && sv10 < mv10)) throws undeclared identifier error ( mv10 , sv10 , sv11 , mv11 ....)
for(int j = 0; j<tfs; j++) { int ii = 0; int find = false; for(int i = 0; i< stochs; i++) { int shift = 1; { { double mv0 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift); double sv0 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift); double mv1 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift+1); double sv1 = iStochastic(Symbname[i],timeframes[j],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift+1); if(TIMEFRAME==1) { double mv10 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift); double sv10 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift); double mv11 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift+1); double sv11 = iStochastic(Symbname[i],timeframes[j+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift+1); } if(TIMEFRAME!=1) { double mv110 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift); double sv110 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift); double mv111 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_MAIN,shift+1); double sv111 = iStochastic(Symbname[i],timeframes[j+1+1],StochK,StochD,StochSlowing,StochMethod,StochPrice,MODE_SIGNAL,shift+1); } if((sv1 >= mv1 && sv0 < mv0) && (sv11 >= mv11 && sv10 < mv10))
When I did that as below now line at the bottom if((sv1 >= mv1 && sv0 < mv0) && (sv11 >= mv11 && sv10 < mv10)) throws undeclared identifier error ( mv10 , sv10 , sv11 , mv11 ....)
declare the doubles outside the gates .you would get that issue with commenting out code too.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi is this even possible in mql4 ?
Being able to comment/uncomment lines within the file depending on the result of some lines somewhere within the same file?
for eg:
or How this/similar can be achieved with use of any device like filter , loop etc ?
Thank you.