Strategy Tester Freezing Question

 

Hello, I've been in the process of editing a custom martingale EA. Normally, the EA works fine when you put in a standard/constant range parameter amount. For instance, if you put in a constant range of 50 pips, new orders with lot multipliers will be made every 50 pip movement. However, when I want to make this constant amount adjustable to the price range, it freezes.


For example, if the trading range within the last three months moved from 2000 to 1300 pips, the EA will automatically adjust this from a range parameter of 200 to 130.


I believe I've done all the coding correctly (using the difference between iHighest and iLowest, then multiplying the result to reach the desired amount) but the strategy tester freezes. When I'm testing over a quarter period, it will work fine from day 1 to day 7, then freeze. I will then have to stop the tester, start at day 8, and then it will freeze at day 45. I then start again at day 46, and it freezes on day 49......and so on and so on.


I was just wondering if anyone knew why it freezes. Some quarters it will only freeze once, other quarters it will freeze 40 times. However, if I just keep the range parameter constant, the EA works fine without any stops.


In my previous post I asked help for the coding part. Now since I got the coding correctly (I think), I was looking for more of an explanation on why this happens so that I can find a way how to fix it; or at least find an alternative to the coding.


THANKS!

 

Most likely u have an error in the calculation of the range

 
qjol:

Most likely u have an error in the calculation of the range


Ohh, I see. I thought I finally fixed that problem. Can you please just take a look at the below code to see if I used it correctly? If I did, can you suggest another function that I could use to produce the same result. I just need to be pointed in the right direction.


Thanks


double highval = High[iHighest(NULL,PERIOD_D1,MODE_HIGH,60,0)];

 
double lowval = Low[iLowest(NULL,PERIOD_D1,MODE_LOW,60,0)];


int DesiredRange = NormalizeDouble(highval - lowval,3)*1000;
 

I ran it myself in visual mode for more than two months and it works just fine without any problem

 
In the tester you can not get bar zero of other timeframes.