giobenoni:
Hi,
Probably newbie question (that's what i am),
I would like to do certain actions (like check price, change variables) based on Candle close actions rather than on each tick.
Could somebody provide me with sample code or another post for me to learn. Found some topics but i'm confused
It would help me a lot.
thanks,
Hello you can read all the information about handling new bar at the following link
https://www.mql5.com/en/articles/159
or you can simply use this code:
datetime NewCandleTime=TimeCurrent(); bool IsNewCandle(){ if(NewCandleTime==iTime(Symbol(),0,0)) return false; else{ NewCandleTime=iTime(Symbol(),0,0); return true; } } void OnTick(){ if(IsNewCandle()){ } }
The "New Bar" Event Handler
- www.mql5.com
Authors of indicators and experts have always been interested in writing the compact code in terms of execution time. You can approach to this problem from different angles. From this broad topic in this article we will cover the problem, that is seemingly already have been solved: check for a new bar. This is quite a popular way to limit the...
thank you Nikolay
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
Hi,
Probably newbie question (that's what i am),
I would like to do certain actions (like check price, change variables) based on Candle close actions rather than on each tick.
Could somebody provide me with sample code or another post for me to learn. Found some topics but i'm confused
It would help me a lot.
thanks,