Indicators: isNewBar

 

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

 
Corrected, thank you.
 

Rosh:
Поправлено, спасибо

изменения не вступают в силу "немедленно"? пока все осталось без изменений...

 
Changes will take effect when the new version is published. Done. Thank you.
 

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...

 
Just what I need! Thank you.
This website uses cookies. Learn more about our Cookies Policy.