Errors, bugs, questions - page 950

 
fyords:

Please advise if anyone has encountered something like this.

There is a code:

In realtime in terminal it works: But in tester the same code gives different result:

Is the size of the array to be obtained regardless of which event occurred?

 
tol64:

And the size of the array should be obtained regardless of which event occurred?

Well, I first wrote the indicator and then reduced everything to a simple example.
It turns out yes - on any event, and the logs that are given are repeated every line.

By changing the code to the following:

//+------------------------------------------------------------------+
double date[];
//+------------------------------------------------------------------+
void OnInit()
{
   ArrayResize(date,3);
   Print(__FUNCTION__," ArraySize(date)=",ArraySize(date));
}
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
   Print(__FUNCTION__," ArraySize(date)=",ArraySize(date));
}
//+------------------------------------------------------------------+

it became even more fun. Result terminal:

FD      0       12:57:59        test (EURGBP.m,M5)      OnInit ArraySize(date)=3
JO      0       12:57:59        test (EURGBP.m,M5)      OnChartEvent ArraySize(date)=3
DG      0       12:57:59        test (EURGBP.m,M5)      OnChartEvent ArraySize(date)=3

Tester:

JM      0       12:58:09        test (EURGBP.m,M15)     2013.01.01 00:00:00   OnInit ArraySize(date)=3
FE      0       12:58:09        test (EURGBP.m,M15)     2013.01.01 00:00:00   OnChartEvent ArraySize(date)=0
FR      0       12:58:09        test (EURGBP.m,M15)     2013.01.01 00:00:00   OnChartEvent ArraySize(date)=0
 
fyords:

Well, I first wrote the indicator and then reduced everything to a simple example.
It turns out yes - by any event, with the logs given repeating every line.

...

I haven't managed to reproduce it. I'm testing this code:

//+------------------------------------------------------------------+
//|                                                     !indTEST.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//---
#property indicator_chart_window
#property indicator_buffers 1 
#property indicator_plots   1
#property indicator_type1   DRAW_NONE
//---
double date[];
//---
//+------------------------------------------------------------------+
//| ИНИЦИАЛИЗАЦИЯ                                                    |
//+------------------------------------------------------------------+
void OnInit()
  {
   ArrayResize(date,3);
  }
//+------------------------------------------------------------------+
//| ДЕИНИЦИАЛИЗАЦИЯ                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   Print("ArraySize(date)=",ArraySize(date));
  }
//+------------------------------------------------------------------+

//---

Tested the indicator in visualisation mode.

 
tol64:

...

Tested the indicator in visualisation mode.

Similarly, figuring it out.
 
fyords:
Similarly, I'm figuring it out.
As far as I know, schedule interaction events are currently ignored in the tester. Custom events can be handled.
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы графиков / Типы событий графика - Документация по MQL5
 
tol64:
As far as I know, events related to interaction with the chart are ignored at the moment in the tester. Custom events can be handled.

I don't really care which ones, as long as they come :)

Also interesting is that your code gives 0 result, i.e. error persists.
PS. Win7 x64 + UAC and not portable.

 
fyords:

I don't really care which ones, as long as they come :)

Also interesting is that your code gives me result 0, i.e. error persists.
PS. Win7 x64 + UAC and not portable.

I don't get any events at all with this code. So at what events is the message printed in the tester? I even wondered, that's why I wanted to know. )) I need a code to reproduce it.

 
tol64:

I don't get any events at all with this code. So at what events is the message printed in the tester? I even wondered, that's why I asked. )) I need code to reproduce it.

I don't understand it either - it doesn't work anymore )).
Strange, because the CHARTEVENT_CHART_CHANGE event should come anyway in the tester. Right?
 

fyords:
... 

Odd, because the CHARTEVENT_CHART_CHANGE event should come anyway in the tester. Right?
In real time, this event is generated when the chart is scrolled and windows/subwindows are resized. In the tester this event doesn't work yet (and maybe they won't do it at all). Of all the events, only user events from other programs can be tracked for now.
 

I have tested the standard ExpertMACD Expert Advisor in the strategy tester, which is delivered together with MT5, it generates errors:

2013.03.30 19:18:09 Core 2 genetic pass (0, 15) tested with error "OnInit failed" in 46 ms

2013.03.30 19:18:08 Core 1 genetic pass (0, 13) tested with error "OnInit failed" in 32 ms

2013.03.30 19:18:07 Core 2 genetic pass (0, 5) tested with error "OnInit failed" in 0 ms

I found out by searching that the error is in the module: "SignalMACD" when optimizing Fast and Slow MACD periods (when ticking the boxes in the strategy tester parameters).

Has anyone encountered such a problem and how to deal with it? (When there is only one tick it works somehow, but there are errors as soon as you check two ticks)

Reason: