Nurudeen Amedu: you can see after the second vertical line, the value is 0 to the end the problem i have is that it stops 10 candles early and i really dont know why it does this
for(int i=0;i<rates_total;i++){ if(close[i+7]>close[i+10]){x++;}
- Had you looked in the Experts tab, you would know it has crashed with an array exceeded error. There are [0 .. rates_total-1] bars. When i is rates_total-10, then i+10 is rates_total which does not exist. Do your lookbacks correctly.
- You are also not setting close and ExtBuffer to AsSeries per OnCalculateTo determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
whroeder1:
Please can you give me the lines to change?- Had you looked in the Experts tab, you would know it has crashed with an array exceeded error. There are [0 .. rates_total-1] bars. When i is rates_total-10, then i+10 is rates_total which does not exist. Do your lookbacks correctly.
- You are also not setting close and ExtBuffer to AsSeries per OnCalculate
Nurudeen Amedu: can you give me the lines to change?
|
|
whroeder1:
|
it would have been a lot easier if you had just fixed it
but am also grateful you didn't, i just learned something new
Nurudeen Amedu: it would have been a lot easier if you had just fixed it but am also grateful you didn't, i just learned something new
| Exactly. You would have learning nothing and would be forever asking similar question. My terse remarks have resulted in many posters putting in some effort and learning. And some have posted that they are grateful that they were forced to study. |
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 coded a basic price calculation for an MT5 oscillator and it calculates correctly
you can see after the second vertical line, the value is 0 to the end
the problem i have is that it stops 10 candles early and i really dont know why it does this