Questions from a "dummy" - page 57

 
Lizar:

I'm going to have a look at the version posted in the article. So far made some experts on spies, works great.

MetaDriver:

I don't think this technology will work in the tester.

It works.

It's just great that it works in the tester. I have not been able to implement it yet. But this is probably due to lack of experience. I have settled on a timer for now, but it is a long one.

When trying to attach the Expert Advisor to the chart, I get such a message:

I do not understand what USDJPY has to do with it. I even commented out the getting of handle on initialization in the code and this message still comes out.

 
Lizar:

It works.

Konstantin, do I understand correctly that the EA executable code, which normally resides in OnTick() or OnTimer(), needs to be placed in OnChartEvent() to make your scheme work in multi-currency mode, both in real time and in tester.
 
tol64:

It's just great that it works in the tester. I haven't been able to implement it yet. But this is due to lack of experience, I guess. I have settled on the timer for now, but it is too long.

When trying to attach the Expert Advisor to the chart, I get such a message:

I do not understand what USDJPY has to do with it. I even commented out the getting of a handle on initialization in the code and this message still comes out.

Haven't looked at it yet.

Tol64:
Konstantin, do I understand correctly that the EA executable code, which normally resides in OnTick() or OnTimer(), needs to be placed in OnChartEvent() to make your scheme work in multi-currency mode, both in real time and in tester.

Yes.

 
tol64:

It's just great that it works in the tester. I haven't been able to implement it yet. But this is probably due to lack of experience. I have stopped at the timer for now, but it is too long.

When trying to attach the Expert Advisor to the chart, I get such a message:

I do not understand what USDJPY has to do with it. I even commented out the getting of a handle on initialization in the code and the message still comes out.

I have looked at it. Expert Advisor is working. There was just a misprint in error message.

What it was giving you was a message that the symbol was not selected in the MarketWatch window. Either set the symbols that the Expert Advisor works with to the MarketWatch window, or comment out the calls of the spyros on the appropriate symbols in OnInit().

I am attaching the modified version of exSpy Control panel MCM.mq5.

Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции
Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции
  • www.mql5.com
Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции - Документация по MQL5
 
Lizar:

I've had a look. The expert is working. There was just a typo in the error message.

What it gave you was a message that the symbol was not selected in the MarketWatch window. Either set the symbols that the Expert Advisor works with to the MarketWatch window, or comment out the calls of the spyros on the appropriate symbols in OnInit().

I attached the modified version of exSpy Control panel MCM.mq5.

I even laughed at myself for my lack of attention))) USDJPY was in the Market Watch window. There was no other symbol, and the prints just had the same message. )))

Thanks.

 
tol64:
Konstantin, do I understand correctly that executable code of the Expert Advisor, which is usually located in OnTick() or OnTimer(), should be placed in OnChartEvent() to make your scheme work in multicurrency mode, both in real time and in tester.

It's better to implement all required functionality in the form of separate procedures and functions (I recommend the latter), and then call it from any place in the Expert Advisor.

If you use OOP, all required functionality can be implemented as a set of several methods of main class (usually it's a descendant of Expert class).

 
Interesting:

It is better to implement all the necessary functionality as separate procedures and functions (I recommend the latter), and then call it from anywhere in the Expert Advisor.

If you use OOP, you can implement all necessary functionality as a set of several methods of the main class (usually it's a descendant of the Expert Advisor class).

At the moment, all functionality is almost implemented in this way. Almost. That is, the entire code is a few functions that contain the basic calculations. I haven't mastered OOP completely yet, but I can already see the profit from using it. The code is growing day by day and soon it will be very inconvenient to use it without OOP.

I've created a separate topic where I've given you the results of various multicurrency testing methods:Results of Multicurrency Expert Advisor Testing. There are still many things on this subject that remain unclear to me.

 

Why are my quotes not loading? For example on EURUSD, they only load up to August of that year. That's all. They don't want to load them any further. Maybe there is a file with quotes somewhere?

I have setthe number of bars to unlimited. I refreshed it several times. I pressed HOME several times. It still does not work.

 

And where's the 'announced complete list' of all MT5 files and their details.

Just got off the baobab today, sorry.

 

A multitemporal fractal indicator.

The essence of the indicator is to display the fractals of one timeframe (or several at once) on another.

Source article: https://www.mql5.com/ru/code/7304, indicator code in MQL4

First I tried to copy and paste it from .mq4-version with some micro corrections for .mq5 (I don't even cite this code - the problem occurred when I discovered careless manipulation of arrays like High[shift+i] inside in MQL4 source code.

bool Fractal (string F,int Per, int shift) {...}

I tried to rewrite it in MQL5 (no default visibility of such arrays outside OnCalculate).

Then I tried to rewrite it for MQL5 using calling several iFractals handles with different parameters PERIOD_.... As a result, the fractals fell apart, though sometimes only one series of fractal arrows on the TF corresponding to it manages to land adequately. What is remarkable, when I return to the same timeframe in the terminal from some other different timeframes the crispness is shown differently which suggests the following: the data in the terminal of this unfamiliar indicator wanders in an incomprehensible way, but I always thought the same erroneous image should repeat stably. Of course, the second variant doesn't even containbool Fractal(string F,int Per, int shift) {...}, which I want to address to experienced developers of indicators.

Here's what I have managed to draw:

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_plots   8

#property indicator_label1  "FractalUp1"
#property indicator_type1   DRAW_ARROW
#property indicator_color1 clrRed
#property indicator_width1  2

#property indicator_label2  "FractalDw1"
#property indicator_type2   DRAW_ARROW
#property indicator_color2 clrRed
#property indicator_width2  2

#property indicator_label3  "FractalUp2"
#property indicator_type3   DRAW_ARROW
#property indicator_color3 clrBlue
#property indicator_width3  2

#property indicator_label4  "FractalDw2"
#property indicator_type4   DRAW_ARROW
#property indicator_color4 clrBlue
#property indicator_width4  2

#property indicator_label5  "FractalUp3"
#property indicator_type5   DRAW_ARROW
#property indicator_color5 clrGold
#property indicator_width5  2

#property indicator_label6  "FractalDw3"
#property indicator_type6   DRAW_ARROW
#property indicator_color6 clrGold
#property indicator_width6  2

#property indicator_label7  "FractalUp4"
#property indicator_type7   DRAW_ARROW
#property indicator_color7 clrSienna
#property indicator_width7  2

#property indicator_label8  "FractalDw4"
#property indicator_type8   DRAW_ARROW
#property indicator_color8 clrSienna
#property indicator_width8  2

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];

int ArrowShift=-10;

int handle1;
int handle2;
int handle3;
int handle4;

int OnInit()
  {
//   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//---
   SetIndexBuffer(0,ExtMapBuffer1,INDICATOR_DATA);
   PlotIndexSetInteger(0,PLOT_ARROW,217);
   PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,ArrowShift);
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer1,EMPTY_VALUE);

   SetIndexBuffer(1,ExtMapBuffer2,INDICATOR_DATA);
   PlotIndexSetInteger(1,PLOT_ARROW,218);
   PlotIndexSetInteger(1,PLOT_ARROW_SHIFT,-ArrowShift);
   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer2,EMPTY_VALUE);

//---
   SetIndexBuffer(2,ExtMapBuffer3,INDICATOR_DATA);
   PlotIndexSetInteger(2,PLOT_ARROW,217);
   PlotIndexSetInteger(2,PLOT_ARROW_SHIFT,ArrowShift);
   PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer3,EMPTY_VALUE);

   SetIndexBuffer(3,ExtMapBuffer4,INDICATOR_DATA);
   PlotIndexSetInteger(3,PLOT_ARROW,218);
   PlotIndexSetInteger(3,PLOT_ARROW_SHIFT,-ArrowShift);
   PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer4,EMPTY_VALUE);

//---
   SetIndexBuffer(4,ExtMapBuffer5,INDICATOR_DATA);
   PlotIndexSetInteger(4,PLOT_ARROW,217);
   PlotIndexSetInteger(4,PLOT_ARROW_SHIFT,ArrowShift);
   PlotIndexSetDouble(4,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer5,EMPTY_VALUE);

   SetIndexBuffer(5,ExtMapBuffer6,INDICATOR_DATA);
   PlotIndexSetInteger(5,PLOT_ARROW,218);
   PlotIndexSetInteger(5,PLOT_ARROW_SHIFT,-ArrowShift);
   PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer6,EMPTY_VALUE);

//---
   SetIndexBuffer(6,ExtMapBuffer7,INDICATOR_DATA);
   PlotIndexSetInteger(6,PLOT_ARROW,217);
   PlotIndexSetInteger(6,PLOT_ARROW_SHIFT,ArrowShift);
   PlotIndexSetDouble(6,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer7,EMPTY_VALUE);

   SetIndexBuffer(7,ExtMapBuffer8,INDICATOR_DATA);
   PlotIndexSetInteger(7,PLOT_ARROW,218);
   PlotIndexSetInteger(7,PLOT_ARROW_SHIFT,-ArrowShift);
   PlotIndexSetDouble(7,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   ArrayInitialize(ExtMapBuffer8,EMPTY_VALUE);

   handle1=iFractals(_Symbol, PERIOD_M15);
   handle2=iFractals(_Symbol, PERIOD_H1);
   handle3=iFractals(_Symbol, PERIOD_H4);
   handle4=iFractals(_Symbol, PERIOD_D1);

   return(0);
  }

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int B1 = BarsCalculated(handle1);
   int B2 = BarsCalculated(handle2);
   int B3 = BarsCalculated(handle3);
   int B4 = BarsCalculated(handle4);

   CopyBuffer(handle1,0,0,B1,ExtMapBuffer1);
   CopyBuffer(handle1,1,0,B1,ExtMapBuffer2);
   CopyBuffer(handle2,2,0,B2,ExtMapBuffer3);
   CopyBuffer(handle2,3,0,B2,ExtMapBuffer4);
   CopyBuffer(handle3,4,0,B3,ExtMapBuffer5);
   CopyBuffer(handle3,5,0,B3,ExtMapBuffer6);
   CopyBuffer(handle4,6,0,B4,ExtMapBuffer7);
   CopyBuffer(handle4,7,0,B4,ExtMapBuffer8);

   return(rates_total);
  }
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   return;
  }
 

Obviously, it lacks some conditional checks inside OnCalculate as well as in external function of bool type or I simply don't use correctly what I have in my code already. Also, maybe arrays need to be initialized correctly in the right place and set as timeseries?

Reason: