In the indicator test in the strategy tester, the test speed gradually decreases. Initial test rate cannot be maintained .
-
You have two arrays being resized on every new bar, that will slow things considerably. Change the two resizes to (arr, Bar, Bar)
-
int limit=MathMin(rates_total-prev_calculated+1,rates_total-1);
This is recalculating bar one and bar zero each tick. Drop the plus one.
-
Otherwise, changing the arrays to a circular queue, would be my only suggestion.
-
double price = open[i];
In MT4, buffers and the predefined arrays are all ordered AsSeries. There is a difference between the arrays passed to OnCalculate (e.g. low[]) and the MT4 predefined variables (e.g. Low[].) The passed arrays have no default direction, just like MT5.
To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
-
You have two arrays being resized on every new bar, that will slow things considerably. Change the two resizes to (arr, Bar, Bar)
-
This is recalculating bar one and bar zero each tick. Drop the plus one.
-
Otherwise, changing the arrays to a circular queue, would be my only suggestion.
-
In MT4, buffers and the predefined arrays are all ordered AsSeries. There is a difference between the arrays passed to OnCalculate (e.g. low[]) and the MT4 predefined variables (e.g. Low[].) The passed arrays have no default direction, just like MT5.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello . This code create by Mladen Rakic .I adapted the indicator to the new event handler and removed everything unnecessary. In strategy tester, the first 3-4 months are tested very quickly in indicator testing. The longer the time, the longer the test time gets longer.In 5 years of testing it slows down drastically after 1 year.I want to learn if there is a way to maintain initial test speed (first 3-4 months).(Note:It is slow in the original version.original version is attached)