Cynthia: What am I doing wrong here ?
if(prev_calculated > 0) limit++; ExtRocBuffer[i] = (close[i] - close[i+InpRocPeriod]) / close[i+InpRocPeriod] * 100.0; |
|
whroeder1:
|
|
Hello Whroeder1,
1st thank you for your response and comment.
Ehm, yes I've looked in the experts tab, but now that you made me uncertain I've looked at it again, and monitored it - but no array out of bounds errors. I swear.
What I did is updated the code like so.
for(int i = limit - 1; i > 0; --i) { ExtRocBuffer[i] = (close[i - InpRocPeriod] - close[i]) / close[i - InpRocPeriod] * 100.0; } return rates_total - 1;
It's a bit strange thinking going backward in the time series, especially if the access mechanism to the values isn't entirely clear to me yet.
I will test this backward traversing method tonight.
Thanks again !
C.
update: just tested it, both solutions side by side, however as you can see also the new code flattens out after a period of deliberate non-refresh.
Cynthia: update: just tested it, both solutions side by side, however as you can see also the new code flattens out after a period of deliberate non-refresh.
for(int i = limit - 1; i > 0; --i) { ExtRocBuffer[i] = (close[i - InpRocPeriod] - close[i]) / close[i - InpRocPeriod] * 100.0; |
|
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 literally took the example listed on https://docs.mql4.com/customind/indicatorbuffers and just modified it slightly to create a ROC [rate of change] indicator.
However even though new quotes arrive the indicator flattens out after a while. Like seen in the attached image. What am I doing wrong here ?
Why doesn't the buffer gets updated while new quotes arrive ? What is it that I'm missing ?
Thanks so much !
C.