How to get the time of the new bar (right on current bar)?

Back to topics list To post a new topic, please log in or register
avatar
7
trader_yang 2015.01.14 15:42
 

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?


Thank you.



avatar
13000
WHRoeder 2015.01.14 18:40 #
 
trader_yang: 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[0].

Back to topics list  

To add comments, please log in or register