[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 428

 
keekkenen >>:

боюсь эта конструкция if(Time[0]>iTime(0,1440,60)) всегда будет возвращать истину, т.к. это iTime(0,1440,60) значение будет на 60 баров левее, чем Time[0]..

что показывает тест ?




Problem statement: I have an EA and I want to optimise it on the last 40 bars (see thread) in the strategy tester, for example.

if(Time[0]>iTime(0,1440,60))

If the time(simulated) became longer than the opening time of the 60th bar on the daily bar, then execute the function what is wrong?!

 
right, then you need to define beforehand the time at which the EA should start testing
since you know when it should end, then do the following

let's say testing ends 2010.02.10 0:00


make a script from the code below

#property show_inputs
// время окончания тестировани						
extern string 		endTestTime 		= "2010.02.10 0:00";
// название пары
extern string		symbolTest			= "";
// период на котором ищем нужное время по номеру testBarCount бара относительно времени endTestTime
extern int 			periodTest		   = 0;
// количество баров в прошлое относительно времени endTestTime
extern int 			testBarCount 		= 60;

int init(){
	if ( symbolTest == "") symbolTest = Symbol();
	// искомое время
	Print(TimeToStr(iTime( symbolTest, periodTest,	iBarShift( symbolTest, periodTest,StrToTime( endTestTime)) + testBarCount)));
}
 

this script allows you to find the time from which you want to test the EA...

set a couple of variables in the EA

extern string startTime = "";
extern string endTime = "";

int StartTime = StrToTime( startTime), EndTime = StrToTime( endTime);

if (Time[0] < StartTime || Time[0] > EndTime) return(0);
 

this script allows you to find the time from which you want to test the EA...

set a couple of variables in the EA

extern string startTime = "";
extern string endTime = "";

int StartTime = StrToTime( startTime), EndTime = StrToTime( endTime);

if (Time[0] < StartTime || Time[0] > EndTime) return(0);
In the startTime we record the time obtained by the script, and in the endTime we record the time entered into the variable endTestTime of the script...
 
costy_ >>:

Постановка задачи: имеется советник, есть желание его оптимизировать на последних, например, 40-ка барах (60 см. ветку)в тестере стратегий.

if(Time[0]>iTime(0,1440,60))

если время(моделируемое) стало больше времени открытия 60-го бара на дневке тогда выполнить функцию что не так?!

so the 60 bar is also modulated relative to the modulated 0 bar

 

Task statement: I have an EA and I want to optimise it on the last 40 bars in the strategy tester, for example, relative to the current time. These forty bars can be on an hourly, 4-hour, daily or other timeframe. The strategy tester works: The time interval at which it works is set on the tester panel. This way of setting the operation time does not meet the above task - to test for 40 bars. It means we need to change the Expert Advisor so that it is not the tester that defines the test time (its capabilities are not satisfied), but the code itself.

Your suggestion will not work, since for the tester, the time that was N bars ago is the current time.


T.K.

For the current time, the tester will calculate the time of opening of a specified bar (backward) starting from the current time. I.e. again will not solve the problem. It should be N bars back from today's (momentary) bar, not from the current time of the tester


Did I get it right.

 
keekkenen >>:
допустим тестирование заканчивается 2010.02.10 0:00


делаем скрипт из кода ниже

The script is good, BUT!!! It will give a time value which must subsequently be 'scored' in the tester panel. This is not good.... But on small TF and small amount of baro it will show such time, which cannot be "scored" in the tester, because in the tester the date and only date is given. Testing is conducted from 00:00 of the start date to 00:00 of the end date. It is impossible to specify the time, especially in minutes!!!!

 

The simple reason is that the tester lives in its own time, while we and the real quotes live in a different time and these time spaces overlap only in our imagination...


it's okay that you can't set the exact time in the tester, put the beginning of the current day or day before the start time - it's already a cost...


This piece of code will cut off extra time before the required optimization start time (what we set in parameters) and after the optimization end time...

if (Time[0] < StartTime || Time[0] > EndTime) return(0);
 

Look at the figure ind. started drawing only with an offset of 60 bars the other day. Below is part of the code. Have you tried any of the recommended ones? Try it and you will get it.

int start()  {
double stoch1, stoch2;
   int pos = Bars-IndicatorCounted() ;  
//----

if(Time[0]>iTime(0,1440,60)) 
   for(int b=0; b<= pos; b++)
   {    
 
keekkenen >>:

этот кусок кода будет отсекать лишнее время до требуемого времени начала оптимизации (то что мы задаем в параметрах) и после времени окончания оптимизации..

My understanding is that the EA will go to the script for data, the bars back should be set in the script.

И! I'm sorry, could you please post the full code of the script? To my shame, I've never written a script in my year and a half of MQL.