ironhak:
Hello everyone. I have an indicator that plot something similar to a moving average and i wanted to "extend" the last value of that buffer to the end of the visible chart. I tried this but nothing plot:
For having a better explination, here's the desired result:
From this:
To this:
Thank's.
I tired with this function:
for(int iBar = Bars-1-MathMax(lookback, prev_calculated); iBar >= 0; --iBar) { my_line_buffer[iBar] = ...... draw_extension(iBar, my_line_buffer[iBar],"obj",clrWhite,3); } return rates_total-1; // Recalculate current bar next tick. // Return value of prev_calculated for next call }; void draw_extension(int index, double price_,string name, color trendline_col, int line_width) { int bar = -5; datetime time_ = Time[0]+PeriodSeconds()*(-1*bar); ObjectCreate(ChartID(),name,OBJ_TREND,0,Time[index],price_,time_,price_); ObjectSetInteger(ChartID(),name,OBJPROP_SELECTABLE,false); ObjectSetInteger(ChartID(),name,OBJPROP_COLOR,trendline_col); ObjectSetInteger(ChartID(),name,OBJPROP_WIDTH,line_width); }
But it does not work. Any suggestion?
Anyone?
ironhak #: But it does not work. Any suggestion?
draw_extension(iBar, my_line_buffer[iBar],"obj",clrWhite,3);
There can be only one "obj" object (trend).
Do not use series index in object names, as they are not unique. As soon as a new bar starts, you will be trying to create a new name (e.g., “name0”), same, existing, previous, name (e.g., “name0” now on bar one.)
Use time (as int) or a non-series index:
#define SERIES(I) (Bars - 1 - I) // As-series to non-series or back.

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
Hello everyone. I have an indicator that plot something similar to a moving average and i wanted to "extend" the last value of that buffer to the end of the visible chart. I tried this but nothing plot:
For having a better explination, here's the desired result:
From this:
Thank's.