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

 
avatara >>:

да не в том вопрос.

Получается, что на тесторе нельзя тестировать советника если его логика основана на показаниях мультитайфреймных индикаторов.

Нужно выносить расчётную часть в советник.

Или я не прав?

wrong - you can

 
Vinin >>:


Конечно не прав.
Но правда не понятно зачем использовать мультитаймфреймные индикаторы?
Советник может обращаться к нужному таймфрейму или брать значения индикатора с нужного таймфрейма.
Использование мультитаймфреймных индикаторов нужно только для ручной торговли.
Получается дополнительное усложнение кода и возможность вноса дополнительных ошибок.

What's wrong with it? Have you looked at the logs?

Some of the writers believe in Tester and iCustom...

If you try to understand it - you may get banned.

If possible, please show how to receive correct data of another timeframe in the indicator called by iCustom (not of the period, which is passed to iCustom) and how it may work in the tester.

It is not an obvious limitation, as for me. I have not found it anywhere.

-----------------

And using all the logic and indicator code instead of iCustom will definitely complicate the EA, but not the other way around as you claim... ;)

 
avatara писал(а) >>

What's wrong? Have you looked at the logs?

Some of those who write believe in Tester and iCustom...

If you try to understand it, you may get banned.

If possible, please show how iCustom indicator may receive correct data of the foreign TF (not of the period passed to iCustom) and how it may work in the tester.

It is not an obvious limitation, as for me. I have not found it anywhere.


If you want to get correct data in the visual mode of tester (more precisely in the indicator overlaid on the visual testing chart), you should provide time synchronization in the indicator.
So, any use of iOpen(), iClose, etc. in this mode is incorrect. The real data is being accessed. Calling a zero bar means addressing the actual last bar.

And most multitemporal indicators based on close prices in visualization mode look into the future (even using time synchronization).
That's why I say that this kind of work is unnecessary, and most likely harmful, because it gives incorrect data.

But this does not apply to iCustom call from EA

 
Vinin >>:


Если ты хочешь получить корректные данные в визуальном режиме работы тестера (точнее в индикаторе, наброшенном на график визуального тестирования), то нужно в индикаторе предусмотреть синхронизацию времени.
Так любые обращение типа iOpen(), iClose и прочее в таком режиме работы некорректно. Идет обращение к реальным данным. И обращение к нулевому бару означает обращение к действительному последнему бару.

И большинство мультитаймфреймных индикаторов построенных на ценах закрытия в режиме визуализации заглядывают в будущее (даже используя синхронизацию по времени)
Потому и говорю, что подобная работа не нужна, а скорее всего и вредна, так как дает не корректные данные.

I repeat.

Check without visualisation.

Your advisor is calling my inductor.

no matter what or how it counts. look at the logs to see what it gets as price from the minute TF.

-------

I have tweaked the example a bit. On tf=1 it doesn't work correctly, on others it works as it should.

Files:
curval.mq4  4 kb
 
avatara писал(а) >>

I repeat.

Check without visualisation.

Your advisor is calling my turkey.

It doesn't matter what or how it counts. look at the logs to see what it gets as price from the minute TF.


Your indicator will return zero because it is made with a logical error.
After a small adjustment, it works fine
 
Vinin >>:

Зачем так сложно
В режиме визуализации работать будет не корректно

Sorry, I was taking a nap, it's +6gmt here.
You're wrong about "complicated", the presented code is just a part of the EA code, it's displayed in the indicator to check
to check if the EA works correctly in test mode.
Now, about "In visualization mode will not work correctly", for programs written correctly and when they work correctly, the program will do (and must do) what the programmer asked it to do and nothing else,
The program will not work correctly, it will do (and must do) what the programmers have set it to do otherwise, otherwise the software is crude and not adjusted, this is my opinion and not mine alone.
What concerns the visualization and non-visualization - is from the field of fairy tales of a bright future:))
I gave the code by which I checked the processed data, it is clearly seen that the adjacent TFs
do not change their data, you can put this indicator on the Onlin EA and check that in Onlin
presented code works correctly, and all 5 indicators show approximately the same logically
related data, the code is described in detail, it should be as described BUT ... How to get around the shortcomings of the batter?
If there are any constructive arguments, suggestions, may I see your code where it will be practically proved
and shown - here is the data of the current TF, and here is the data of higher and lower TF in TESTOR mode.
Please, move arguments about nothing to other threads, or we will miss a useful idea in these unnecessary disputes.

I apologize if anything is wrong. No offense. We still need to debug the software, we still have suggestions.

 
vladv002 писал(а) >>

Sorry, I was taking a nap, it's +6gmt here.
You're wrong about "complicated", the presented code is just a part of the EA code, it's displayed in the indicator to check
to check if the EA works correctly in test mode.
Now about "In visualization mode will not work correctly", for programs written correctly and when they work correctly, the program will do (and must do) what the programmer asked it to do and nothing else,
The program will not work correctly, it will do (and must do) what the programmers have set it to do otherwise, otherwise the software is raw and out of order, it's my opinion and not mine alone.
What concerns the visualization and non-visualization - is from the field of fairy tales of a bright future:))
I gave the code by which I checked the processed data, it is clearly seen that the adjacent TFs
do not change their data, you can put this indicator on the Onlin EA and check that in Onlin
presented code works correctly, and all 5 indicators show approximately the same logically
related data, the code is described in detail, it should be as described BUT ... How to get around the shortcomings of the batter?
If there are any constructive arguments, suggestions, may I see your code where it will be practically proved
and shown - here is the data of the current TF, and here is the data of higher and lower TF in TESTOR mode.
Please, move arguments about nothing to other threads, or we will miss a useful idea in these unnecessary disputes.

I apologize if anything is wrong. No offense. I have to debug software, I still have suggestions.


The indicator is designed to work in real time.
Once again it does not take its values from the virtualization graph, but from real recent data.
We can make it work on the virtualization chart as well, but we have to understand that it will not work correctly because the data will still be taken from the real history and not from the simulated one. There will be a glimpse into the future, maybe there will not be enough history for calculations. And there may be a lot more.
There will be a whole other set of questions.
 
Here is a simple indicator that writes Close values from 6 timeframes into its 6 buffers.
//+------------------------------------------------------------------+
//|                                               MultiTimeframe.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Navy
#property indicator_color3 DarkSlateGray
#property indicator_color4 Orange
#property indicator_color5 Magenta
#property indicator_color6 CornflowerBlue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,ExtMapBuffer6);
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   ExtMapBuffer1[0]=iClose(Symbol(),PERIOD_M1,0);
   ExtMapBuffer2[0]=iClose(Symbol(),PERIOD_M5,0);
   ExtMapBuffer3[0]=iClose(Symbol(),PERIOD_M15,0);
   ExtMapBuffer4[0]=iClose(Symbol(),PERIOD_M30,0);
   ExtMapBuffer5[0]=iClose(Symbol(),PERIOD_H1,0);
   ExtMapBuffer6[0]=iClose(Symbol(),PERIOD_H4,0);   
//----
   return(0);
  }
//+------------------------------------------------------------------+
And here is an Expert Advisor, which receives values from this indicator and displays these values on the chart only in visual testing mode.

//+------------------------------------------------------------------+
//|                                                     SimpleEA.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   if(IsTesting())
     {
      if(IsVisualMode())
        {
         double M1_Value=iCustom(Symbol(),0,"MultiTimeframe",0,0);
         double M5_Value=iCustom(Symbol(),0,"MultiTimeframe",1,0);
         double M15_Value=iCustom(Symbol(),0,"MultiTimeframe",2,0);
         double M30_Value=iCustom(Symbol(),0,"MultiTimeframe",3,0);
         double H1_Value=iCustom(Symbol(),0,"MultiTimeframe",4,0);
         double H4_Value=iCustom(Symbol(),0,"MultiTimeframe",5,0);
         string com="Last Bid="+DoubleToStr(Close[0],Digits)+"\n";
         com=com+"iClose(M1,0)="+DoubleToStr(M1_Value,Digits)+"\n";
         com=com+"iClose(M5,0)="+DoubleToStr(M5_Value,Digits)+"\n";
         com=com+"iClose(M15,0)="+DoubleToStr(M15_Value,Digits)+"\n";
         com=com+"iClose(M30,0)="+DoubleToStr(M30_Value,Digits)+"\n";
         com=com+"iClose(H1,0)="+DoubleToStr(H1_Value,Digits)+"\n";
         com=com+"iClose(H4,0)="+DoubleToStr(H4_Value,Digits)+"\n";
         Comment(com);
        }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

If after that you continue to argue that the indicators in the tester are not correctly calculated or the price data from non-native timeframes are modelled, you will have to provide proof otherwise you will be banned. Banned.
 
Vinin >>:


Индикатор предназначен для работы в реал-тайм.
Я еще раз повторюсь что он берет свои значения с не с графика виртуализации, а с вполне реальных последних данных
Можно сделать что бы он работал и на графике виртуализации, но надо понимать что будет не совсем корректная работа, так как данные все равно будут браться с реальной истории, а не с моделированной. Будет заглядывание в будущее, возможно не будет хватать истории для расчетов. Да и много еще что может быть.
Появятся совсем другие вопросы.

I must have said something wrong, I'm sorry, I'll try again in more detail.
Each TF has its own bars which have their own time - why do we have a look ahead?
I know that there are Expert Advisors with a look ahead,
it's a child's play.
What are you talking about "The indicator is designed to work in real time.", we are talking about the Tester!
Specific question - the tester is not giving data from adjacent TFs, only data from the current TF is coming in - HOW to properly
circumvent this shortcoming of the MT4 system tester
.
None of the MQL4 functions can return data from the adjacent TFs in the tester, either above or below it.
If the data is there, you may fix it, check it, display - Comment,Alert,Print - or pass it for processing.
Any suggestions on how to eliminate this disadvantage in the Tester, I'd be very grateful to you and I think I'm not the only one.


 
Rosh >>:
Вот простой индикатор, который пишет в 6 своих буферов значения Close с 6-ти таймфреймов.
А вот эксперт, который получает значения из этого индикатора и выводит полученные значения на график только в режиме визуального тестирования.


Если и после этого вы продолжите утверждать, что в тестере неверно считаются индикаторы или моделируются ценовые данные с неродных таймфреймов, то вы обязаны будет предоставить доказательства, иначе бан. Надоело.

Thanks for the convincing example from the developers.

Extremely useful to have at hand. Before testing, to check the correctness of the work.

But my local problems remain - as you can see M1=0.0. :(

Although I deleted history files and stuff...

I will learn more.

Thanks again for all your help.

Reason: