THANK YOU
Could you please add the magic number for the EA? Thank you.
Thanks for this tiny simple example using BB+ADX indicator.
After some improvements (and especially adding +DI, -DI), I got very good results.
Allow me to point out the "IsNewBar" function which doesn't work :
The "m_TOld" variable is not static and will always be different than "TNew".
You can replace it by that : (see: https://www.mql5.com/en/articles/22)
//+------------------------------------------------------------------+ //| Returns true if a new bar has appeared for a symbol/period pair | //+------------------------------------------------------------------+ bool isNewBar() { //--- memorize the time of opening of the last bar in the static variable static datetime last_time=0; //--- current time datetime lastbar_time=SeriesInfoInteger(Symbol(),Period(),SERIES_LASTBAR_DATE); //--- if it is the first call of the function if(last_time==0) { //--- set the time and exit last_time=lastbar_time; return(false); } //--- if the time differs if(last_time!=lastbar_time) { //--- memorize the time and return true last_time=lastbar_time; return(true); } //--- if we passed to this line, then the bar is not new; return false return(false); }
And now there is no more problem.
Best wishes ;)

The "New Bar" Event Handler
- 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.

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
Well Martin:
Well Martin EA is based on two indicators: Bollinger Bands and ADX. It is designed for use on a tranquil market.
Author: Andrew Kornishkin