Before posting a question, please use the search engine, you will find a lot of existing resources :
- How to detect a new bar
- Indicate a new bar
- Improve your time execution by removing Bars function calls
- Make EA open a trade only when a new bar starts
Proposed solution in the Codebase :
- isNewBar - indicator for MetaTrader 5
- The "New bar" event handler for the indicators
- New Bar Alerter
- IsNewBar - library for MetaTrader 5
And even an article dedicated to the subject : The "New Bar" Event Handler
The "New Bar" Event Handler
- 2010.10.11
- Konstantin Gruzdev
- www.mql5.com
MQL5 programming language is capable of solving problems on a brand new level. Even those tasks, that already have such solutions, thanks to object oriented programming can rise to a higher level. In this article we take a specially simple example of checking new bar on a chart, that was transformed into rather powerful and versatile tool. What tool? Find out in this article.
Alain Verleyen:
thanks man
Before posting a question, please use the search engine, you will find a lot of existing resources :
- How to detect a new bar
- Indicate a new bar
- Improve your time execution by removing Bars function calls
- Make EA open a trade only when a new bar starts
Proposed solution in the Codebase :
- isNewBar - indicator for MetaTrader 5
- The "New bar" event handler for the indicators
- New Bar Alerter
- IsNewBar - library for MetaTrader 5
And even an article dedicated to the subject : The "New Bar" Event Handler
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
So I was using this piece of code to calculate the most recent bar.
datetime now_bar=Time[0];
if(BarTime!=now_bar)
{
BarTime=now_bar;
}
I am having trouble converting it to do the same thing on meta trader 5.
Im relatively new to coding but thought I may aswell learn mt5 editor cause mt4 is dieing out.