MT4 tester does not give information from other timeframes - page 4

 
Redo the turret e.g. momentum, calling it a little differently, add external variable TF = 15, read on M1 data for example. In Init define the required multiplier coef = 15. On each bar, we look whether this bar is the start and for the fifteen-minute TF, on it in the indicator read the value of Momentum once for this bar and at further 14 bars return the same value. It is probably important that the minute bars do not have omissions, or somewhat differently read the indicator, checking the time of each bar. Calculating the value at the required bar:
    
      j=coef*i;
      MomBuffer[j]=Close[j]*100/Close[j+MomPeriod*coef];
There is only one thing left to implement.
 

Sych писал(а) >>

try to use ArrayCopyRates function,


respectively, instead of iClose(Symbol(),tf,0), you should write arr1[0][4], - it works fine and most importantly much faster, because there is no copying, but only redirection.

Unfortunately, this number did not work with ArrayCopyRates(), only that TF where the test is running,
The adjacent ones are silent!
We must make 9 arrays like "ArrayCopyRates()" and load all data from 9 files there.
I need to combine your suggestion with the esteemed "avatara" and something will work out.
For now I will check how it will read from the files.

 
yuripk >>:
Переделать индюк например моментум, обозвав его чуть иначе, добавить внешнюю переменную TF = 15, считаем на данных M1 для примера. В Init определяем нужный множитель coef = 15. На каждом баре смотрим, является ли этот бар началом и для пятнадцатиминтного ТФ, на нём в индикаторе считаем значение моментума один раз для этого бара и при 14 последующих барах возвращаем это же значение. Важно наверное, чтобы минутки не имели пропусков, или несколько иначе считать показания индикатора, проверяя время каждого бара. Подсчёт значения на нужном баре:
Осталось реализовать.

Another normal option is to make your own bars as the data comes in, there's something here, but I'll have to scratch my head!
Thank you.

 
vladv002 >>:
В процессе познания MQL4, выяснил что, как минимум мой тесер не отдает информацию
с других ТФ. Вот код проверки, его можна на любой эксперт подвесить, у моего тестера
меняются показания только того ТФ на котором тестирую, а другие стоят на месте.

Are you testing this code in visual testing mode? Read the article MetaTrader 4 Tester: A must-know
 
vladv002 >>:

Еще нормальный вариант - делать свои бары по ходу поступления данных, тут чтото есть, но надо репу почесать!
Спасибо.


Exactly. I call it modelling;)

And you will always be guaranteed that they are correct.

Plus you will be able to realize non-standard TFs. M3 for example... or H8. H6 is interesting.

------

Only you'll have to run the tester on minutes.

 
vladv002 писал(а) >>

Another normal option is to make your own bars as the data comes in, there's something here, but I'll have to scratch my head!
>> Thank you.



A normal working example https://www.mql5.com/ru/code/9603
 
Vinin >>:


Нормальный пример работы https://www.mql5.com/ru/code/9603

In the tester?

 
avatara писал(а) >>

>> In the tester?


A normal indicator works correctly in the tester too. Both multi-currency and multi-timeframe.

 
Rosh >>:
Вы что, проверяете этот код в режиме визуального тестирования? Почитайте статью Тестер в терминале MetaTrader 4: Это необходимо знать

How else can I quickly check the behaviour of the indicator on the history?

In my example, the minute data is not correct.

Will they be more correct in non-visual testing?

I am probably dumb...

 
Vinin >>:


Нормальный индикатор корректно работает и в тестере тоже. И Мультивалютный, и мультитаймфреймный.

Would you be so kind as to correct the code. Just output the correct data from the M1.

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_style1 0
#property indicator_color1 Orange
#property indicator_width1 2
#property indicator_style2 0
#property indicator_color2 BlueViolet
#property indicator_width2 2
extern bool Test=true;
//03/04/10
//SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

//---- buffers
double DMA[];string PARA;int hFile,j=0,shift,dayshift;
double Mtimes[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()

{PARA=Symbol();
if (Test) hFile=FileOpen("Dt"+Symbol()+Period()+".csv",FILE_CSV |FILE_WRITE,";");
ArrayCopySeries(Mtimes,MODE_CLOSE,Symbol(),PERIOD_M1);
int error=GetLastError();
if(error==4066)
{
//---- делаем еще 2 попытки чтения
for(int i=0;i<2; i++)
{
Sleep(5000);
ArrayCopySeries(Mtimes,MODE_CLOSE,Symbol(),PERIOD_M1);
}
}
if (Test) FileWrite(hFile,"-Begin--",Mtimes[0]);

//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,DMA);
SetIndexShift(0,0);
SetIndexLabel(0,"inv");

return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
if (Test) FileClose(hFile);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{

//----
int counted_bars=IndicatorCounted();
int i,N;double Value;
N=Bars-counted_bars;

if(counted_bars<0) return(-1);
//---- last counted bar will be recounted

if (N==0) return(0);
j++;
if (Test){ FileWrite(hFile,j,"--1M15 ",StrTime(iTime(Symbol(),Period(),1)),iClose(PARA,0,1));
FileWrite(hFile,j,"--0M15 ",StrTime(iTime(Symbol(),Period(),0)),iClose(PARA,0,0));
FileWrite(hFile,j,"--0M1 ",StrTime(iTime(Symbol(),Period(),0)),iClose(PARA,1,0));
FileWrite(hFile,j,"--1001M15 ",StrTime(iTime(Symbol(),Period(),1000)),iClose(PARA,0,1001));
}
for (i=N-1; i>=0; i--)
{
Value=iClose(PARA,0,i);

// Print (i,"=",Value);
DMA[i]=Value;
}

return(0);
}
//+------------------------------------------------------------------+
string StrTime(datetime IT){
return(StringConcatenate(TimeYear(IT),".",TimeMonth(IT),".",TimeDay(IT)
, "-",TimeHour(IT),"^",TimeMinute(IT),"^",TimeSeconds(IT)));
}

We are testing on m15.
Thanks in advance!