Drawing trendline beyond last bar to the right

 

The following code draws a short horizontal trendline from the top (Close) of the last candle towards the left for about 5 bars.

Is there any way to extend the trendline towards the right a few bars beyond the last bar (just a few bars, not into infinity)?

objName = "TESTTrendLine";
if (ObjectFind(objName) != -1) ObjectDelete(objName);
int startBar = 7;
int runBars = 7;
double price = Close[0];
datetime startDatetime = iTime(Symbol(), 0, 5);
datetime endDatetime = iTime(Symbol(), 0, 0);
ObjectCreate(objName, OBJ_TREND, 0, startDatetime, price, endDatetime, price);
ObjectSet(objName, OBJPROP_COLOR, Red);
ObjectSet(objName, OBJPROP_WIDTH, 2);
ObjectSet(objName, OBJPROP_RAY, False);

 

Just put a future time integer into endDatetime.

endDateTime = Time[0] + (60*Period() * BarsIntoFuture)

Reason: