BO Backtester Code Snippet

 

Here is an attempt of a code snippet to backtest indicators for BO. You can implement it into any indicator and backtest the signals. Attached is an example for testing signals given by RSI 7 overbought and oversold for 15 minutes expiry.

 

Well, after a couple of tests, it appears that the versions of the first post are buggy. I didn't notice that first, cause the market is closed and charts don't refresh automatically, but if I refresh manually, the count for signals doubles, so it adds a second count to the first one. Also, a change of the expiry time, in the settings, doesn't seem to change the test. I've tried to fix this, but without success, so if anyone wants to or can help, it's more than welcome.

I think the problem comes from this part :

for(i=limit; i>=0; i--)

{

datetime time_for_entry = iTime(NULL,0,i-1);

datetime expiry_time = time_for_entry + MinutesExpiry * 60;

expiry_price = iClose(NULL,PERIOD_M1,iBarShift(NULL,PERIOD_M1,expiry_time,True));

if(ArrowsBuy != EMPTY_VALUE || ArrowsSell != EMPTY_VALUE)

count = 1; else count = 0;

if((ArrowsBuy != EMPTY_VALUE && Open expiry_price))

itm = 1; else itm = 0;

}

for(i=0; i<=limit; i++)

{

count_total += count;

count_itm += itm;

count_otm = count_total - count_itm;

}

count_winrate = count_itm * 100 / count_total;

BackTest(count_total,count_itm,count_otm,count_winrate);

[/CODE]

I've tried to change the way to calculate the sum of total and good signals (count_total += count; and count_itm += itm;) to

[CODE]

count_total=0; count_itm=0;

for(int k=0; k<limit; k++) count_total += count;

for(int k=0; k<limit; k++) count_itm += itm;

but it either crashed the terminal or rendered unreal values...

 
airquest:
Here is an attempt of a code snippet to backtest indicators for BO. You can implement it into any indicator and backtest the signals. Attached is an example for testing signals given by RSI 7 overbought and oversold for 15 minutes expiry.

Updated and fixed version. Thanks to spectra9 for his help on developping this code. Enjoy.

 

I was looking for something like this for many weeks ;-)


thanks for sharing. Now I have to study :)

 

Hi Airquest! Can you help my how to put that code in source code in indicators? I m not programer , but i make some indicators over EA Builder and mush its help me that code for testing more faster!

 
pajazipi:

Hi Airquest! Can you help my how to put that code in source code in indicators? I m not programer , but i make some indicators over EA Builder and mush its help me that code for testing more faster!

Leave EaBuilder and you will be able to schedule !!!
 
can you add martingale to this code and how?