Strategy tester: load external parameters from file dependent on date

 

Hi, I was trying to find but I dont see such a topics before


I have a parameter dependent on a date - in a real time its ok - I can just load it from file daily and use it 


What I was expecting from strategy tester: that I can upload the whole file

format is

date1,par1

date2,par2,

etc


OnInit():

<load file and put it to arrays: dates and pars>


and in OnTick() I write:

datetime cur_date = TimeCurrent(); // I assume that in tester it will be historical date

double cur_par;

for (int i = array_size-1; i >= 0; i--)

{

	if (cur_date > dates[i]) // in tester we found that - historical date of tester
	{
		cur_par = pars[i]; // historical value of parameter
		break;
	}

} 



So, when expert is running - its ok - so Init() works - file is loaded and in OnTick() it derives parameter which is actually the current one (today is the last date in file) - so I just tested this 

And I expected that strategy tester actually reproduces all the code including OnInit() and OnTick() but from logs I dont see any parameters loaded 

Could you please advise or direct me to right direction 

Am I inventing a wheel over here and there is another way or just it is not possible at all?


Many thanks

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.
 
Vvv Kkk:

So, when expert is running - its ok - so Init() works - file is loaded and in start() it derives parameter which is actually the current one (today is the last date in file) - so I just tested this 

What is the function start() ?

 
Keith Watford #:

What is the function start() ?

Edited, OnTick()
Reason: