- When you post code please use the SRC button! Please edit your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum -
Why did you post your MT4 question in the
Root /
MT5 General section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. int y; double a=Close[y]; double b=iMA(NULL,0,300,0,1,0,y);
Y has a random value, therefor a and b are also.for(y=60;y>0;y--){ if(a>b){ CounterUP++; } }
A and b never change inside the loop, so CounterUp can only be zero or 60.-
Don't double post!
General rules and best pratices of the Forum. - General - MQL5 programming forum
Thanks for that!
Sorry about double posting!
just realised after it was in the wrong section.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, I am fairly new to MQL4 programming.Was doing ok but I am completely perplexed by this bit of code. All I want is to find on a one minute chart, the last 60 candles and compare the closing price to the price of the 300ema, and then set up a counter of how many of those closing candles are above the comparable 300 moving average. I have set up a for loop counting down from 60 to 1, and then an if statement with a variable CounterUP that keeps count of how many candles are above ema. And then an alert at the end which should print how many.
The for statement does not seem to work properly. Any suggestions would be welcome.
Thanks
void OnTick()