Just put a future time integer into endDatetime.
endDateTime = Time[0] + (60*Period() * BarsIntoFuture)
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
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);