Download MetaTrader 5

Indicators: isNewBar

To add comments, please log in or register
MQL5 Cloud Network speeds up calculations. Try it!
Automated-Trading
Admin
99374
Automated-Trading 2010.05.07 16:39 

isNewBar:

The function allows checking whether a new bar has appeared on the specified timeframe.

For the indicators and Expert Advisors it's very often necessary the information whether a new bar has appeared on the specified timeframe. Here is an example, how it can be done.

After the first call of the isNewBar() function, the current bar is not assumed as a new bar. The function saves its time, it's the current bars, the next bar will be new. The code is commented, it's easy to understand, I hope it will be useful.

Author: Prival

johhny6
130
johhny6 2012.01.11 11:46  

What are peoples thoughts on the best way to use an IsNewBar() type approach, during back-testing?


making decisions based on tick count is one, but using IsNewBar() based on time or Bars() just doesn't back test well at all...

To add comments, please log in or register