the for loop is
for(int i=0;i<uncountedbars;i++)
so the index i increases, and a high i means a bar towards the right, and a low i means a bar near the left of the graph, and the formula for mcs is
mcs[i] = bv - sv + mcs[i+1];
so i+1 is an index in the future of the bar i, so i guess you need
for(int i=uncountedbars-1;i>=0;i--)
the for loop is
so the index i increases, and a high i means a bar towards the right, and a low i means a bar near the left of the graph, and the formula for mcs is
so i+1 is an index in the future of the bar i, so i guess you need
I see, correct me if Im wrong,so it means that the current Candle is actually the latest ith period while the history candles has lesser i values?
yes for MT4, the current candle on the right has index 0 for the arrays as ''timeseries''
watch those 2 videos
https://youtu.be/tk0uyhPNFl8the for loop is
so the index i increases, and a high i means a bar towards the right, and a low i means a bar near the left of the graph, and the formula for mcs is
so i+1 is an index in the future of the bar i, so i guess you need
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int BarLimit = rates_total - prev_calculated; if(!prev_calculated){ BarLimit-=2; } for(int i = 0 ; i <= BarLimit ; i++) { } return(rates_total); }
You have an Array Out of Range problem and probably Calculation Problems.
Unfortunately cannot help with the Calculations of your indicator as I never used tick_volume[] and did not find the proper documentation for the array.
- 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! Im new in meta Editor, I tried to make a custom Indicator that shows the commulative sum, in my case the commulative sum of mcs[]; here is my code:
the indicator doesnt show the commulative sum, what is wrong with my code? please I need some advice. thanks in advance!!