Strategy-Tester Start-Date - can I get it?

Back to topics list To post a new topic, please log in or register
avatar
2017
gooly 2015.02.22 21:10
 

Is there a way to get the start date of the fxt-tester-file?

If I start a backtest I see in the journal: 

2015.02.22 21:02:00.775 TestGenerator: symbol EURUSD period 1 model 0 from 2011.11.06 to 2015.02.06

Is there a way to check in OnInit() whether the start-date of the EA (Time[0]) is too close to the "Use-Date From:.." in the case I need to set some indicators and values by prior bars?

avatar
250
ffoorr 2015.02.23 14:43 #
 

Tester start at the same date than indicated in the tester, unless  there is indication style:  if( Bars < 500 ) return(0); in an indicator or in an EA.

othewise the tester start with 1000 Bars, 

Just code some object LABEL whitch show those indications

avatar
12985
WHRoeder 2015.02.23 14:58 #
 
Build 599- guaranteed that there will be at least 100 bars from the initial bar zero. If you need more, you must check for that and handle it - tester irrelevant.
avatar
2017
gooly 2015.02.23 16:46 #
 

As I created the fxt-files myself and set them write-protect your a.m. suggestions will not work in my case I guess.

But I see in the journal-tab the fist and last date so I had a little hope to get these values inside an EA.

Of course I can find a way with the hard coded begin-date - but I'd like to avoid this.


avatar
250
ffoorr 2015.02.23 20:52 #
 

Look at that whroeder, it's a back test in M1, start date in tester is 3 February

https://www.mql5.com/en/charts/3066419/clh5-m1-fxpro-financial-services?bind=1

I have this line in the EA but it do not matter :

void OnTick()
   {
   if(Bars < 550 ) return(0);
avatar
2017
gooly 2015.02.23 23:00 #
 

For a multi-time frame EA I use only m1. From there I 'fill' the needed amount of bars to start trading.

Now I wanted to have a test whether the highest timeframe (e.g. D1) still has enough m1 bars before the trading starts:

e.g. I nee 100 bars => 100*1440 => 144000 minute bars.

Due to the weekends (no bars but lots of seconds) I can't just calculate Time[0]-144000*60 :(

I found this solution

datetime tmeStart = iTime(NULL,PERIOD_M1, iBarShift(NULL,PERIOD_M1,iTime(NULL,PERIOD_D1,100)));
if ( tmeStart == 0 ) return( INIT_PARAMETERS_INCORRECT ); 

If now this tmeStart is before the first date of the data I get 0.

For real-time chart this is not required!


Back to topics list  

To add comments, please log in or register