How to check a bar (candle) is closed?

 

Hi all,

I am using MetaTrader 4 to implement my indicator using mql4. In my code I would like to check whether a candle or if it called a bar is closed with the defined resolution. For instance if each bar's duration is one minute, I would like to read its values when it is closed not while it is still changing. Does anybody know how can I check if a bar is closed?

Regards,

Danesh

 
Danesh Daroui:

Hi all,

I am using MetaTrader 4 to implement my indicator using mql4. In my code I would like to check whether a candle or if it called a bar is closed with the defined resolution. For instance if each bar's duration is one minute, I would like to read its values when it is closed not while it is still changing. Does anybody know how can I check if a bar is closed?

Regards,

Danesh

The current candle that is not closed yet is referred by index zero. For example Low[0] for its low. You want to avoid reading un-closed candle? Simply avoid referring to zero index.

 

Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
          General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon.