- Wait for a new candle.
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
New candle - MQL4 programming forum - Remember Bid or iOpen(…, 0). There is no "calculating."
- Wait for a new candle.
- Remember Bid or iOpen(…, 0). There is no "calculating."
Hello everyone. Please help me figure out the best approach to calculating the open price of every new candle. Thank you in advance.
Example: Birth of new bar ( #18 ).

- 2019.08.18
- www.mql5.com
Welcome to MQL5.
Try this and I guess you will get the answer.
#include<TradeAlgorithms.mqh> CIsNewBar newbar; void OnStart() { if(newbar.IsNewBar(NULL,0)) { Print(iOpen(NULL,0,0)); } }
Welcome to MQL5.
Try this and I guess you will get the answer.
No free help
urgent help.
Or pay someone. Top of every page is the link Freelance.
Hiring
to write script - General - MQL5 programming forum
Show us your attempt (using the CODE button) and state the nature of your problem.
No free help
urgent help.
Or pay someone. Top of every page is the link Freelance.
Hiring
to write script - General - MQL5 programming forum

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use