I would like to draw a Trend (cf: the red line in the screenshot) which starts on the current bar and ends on the next new bar.
I am using this function: ObjectCreate( trendName, OBJ_TREND,window, timeStart, priceStart, timeStop, priceStop);
I have probleme of getting the timeStop value.
On Forex, the time is continue, so timeStop= TimeCurrent() + Period()*60;
On CFD for exemple, the time is not continue (the chart can stop at 20pm and start at 7am). There is a time gap on each day.
So how can I get currectly the time of a new bar? Or do you have any idea to drop such a line?
You can't get the time of a new bar until there is a new bar. No tick, no bar - even on forex.
No need for your timeStop= TimeCurrent() + Period()*60. Just wait for the new bar to start and get the actual time Time.