Download MetaTrader 5

Build 851 July 30, 2015 IndicatorCounted() Bug

To add comments, please log in or register
Unable to find the right application? Order it!
revival_fx 2015.08.05 18:33 

I have been using the production Metatrader 4 from for some back testing of EAs. (Not tied to a broker MT4). Therefore, I get regular updates of the latest release. I kind of like that. So this is not a complaint.

I noticed that with the latest update Build 851, the first time an indicator is put on a chart IndicatorCounted() returns a value that is almost as big as the value of Bars (it should be zero). If Bars = x, IndicatorCounted() returns x-2. I have only tried this on EURUSD H4. The difference between those 2 numbers is obviously 2. Only two bars worth of data is displayed by the indicator at first. If your indicators are adaptive this is a problem.

For that reason the indicator does not display any history because a common way of writing indicators includes code that is similar to this:

int start() {

int i;

int counted_bars=IndicatorCounted();

if(counted_bars > 0) {



int limit = Bars-counted_bars-1;


Is it catastrophic? No.

Is it insurmountable? No.

Have I fixed my indicators? Yes. I just manipulated the value of limit above to be closer to the value of Bars than to say 2.

But backwards compatibility is something that MT4 is somewhat known for with only a few examples of discontinuity. I just want to make people aware of the fact that this is happening.

I also noticed that the strategy tester is dog slow compared to Build 840 when everything was working just fine. I've moved back to a broker based Build 840 for backtesting now. No fixes needed.

I hope this helps someone. I haven't really posted here before so maybe the powers that be will see this.

whroeder1 2015.08.05 19:36  
stauroucristou: haven't really posted here before so maybe the powers that be will see this.
This is a user's forum not Metaquotes.
To add comments, please log in or register