iVolume returns a long, so you should change A to a long and remove the first cast (I would also change the Average array to be long and remove the second cast)
for(int k = 0; k <= 13; k++) { long A = 0; startbarindex[k] = iBarShift(P[k], PERIOD_M1, iTime(P[k], PERIOD_D1, Bar)); for(int p = 1; p <= startbarindex[k]; p++) { A += iVolume(P[k], PERIOD_M1, p); } Average[k] = A / startbarindex[k]; }
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
I have this following code volume average. But its showing wrong data & data is changing in every tick into really big larger value. Not sure what is the problem here.
Thank you in advance.