Hello,
What you need is to calculate the variation between two points, and divide it by the amount of bars counted.
Change_per_bar = (Value_now / Previous_value) / bars counted;
That would give you an average increment or decrease by bar, and then you can draw the "future" line based on each increment.
However, the slope is a visual perspective and does not -and cannot- not apply here.
Cheers
void TLine( string name, datetime T0, double P0, datetime T1, double P1, color clr, bool ray=false){ if (!Show.Objects) return; #define WINDOW_MAIN 0 if (ObjectMove( name, 0, T0, P0 )) ObjectMove(name, 1, T1, P1); else if (!ObjectCreate( name, OBJ_TREND, WINDOW_MAIN, T0, P0, T1, P1 )) Alert("ObjectCreate(",name,",TREND) failed: ", GetLastError() ); else if (!ObjectSet( name, OBJPROP_RAY, ray )) Alert("ObjectSet(", name, ",Ray) failed: ", GetLastError()); if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change Alert("ObjectSet(", name, ",Color) [4] failed: ", GetLastError()); } : double ma2 = iMA(..., 2), ma1 = iMA(..., 1); TLine("MAprojected", Time[2], ma2, Time[1], ma1, Red, true);
for indicators you can also use SetIndexShift to shift a buffer into the future.

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 was wondering if someone could give me some tips or point me in the right direction to continue the end of a moving average indicator into the future.
Basically what I want to do is get the slope of the indicator line for the last two periods and then draw the indicator going into the future with a straight line for that slope.
I think it will need to use the funtction to shift the indicator but I'm just not sure how I should get started.
Any help is greatly appreciate :)
Thanks.