Discussion of article "Creating an Expert Advisor, which Trades on a Number of Instruments" - page 2

 
gisip:
Everything works fine on MQL4 without a timer.
Your statement is not quite acceptable, we are talking about multicurrency testing. There is no timer in MT4, but there is no multicurrency tester either. When working on MT4, the Expert Advisor in any case depends on the intensity of the quotes flow of the instrument on which it works. Imagine such a situation: let's say you have a multicurrency Expert Advisor on EURUSD, and if in some quantum of time there are no ticks on this pair, how are you going to track the arrival of new ticks on other instruments?
 
Interesting:

Well, it doesn't exist in MQL4, also structures and classes don't exist there, do you propose to abandon them here?


IMHO

To use or not to use the standard library is a matter of everyone's taste (at the worst, you can use only your own code), but to give up all the advantages just because they are not available in MT4 is not very reasonable.....

I didn't write about that at all.

I wrote that MQL5 is glitchy and produces erroneous data in certain combinations of instruments.

For example: If EURJPY or EURGBP is overlaid on the EURUSD chart, everything is fine.

But if you overlay EURCAD, the data on the chart is in error, while in MQL4 there was no such error.

 
gisip:

I didn't write about that at all.

I wrote that MQL5 glitches and produces erroneous data with certain combinations of instruments.

For example: If EURJPY or EURGBP is overlaid on the EURUSD chart, everything is normal.

But if you overlay EURCAD, the data on the chart with an error, while in MQL4 this was not the case, there is no error.

I understood that, but Kos is right (especially nice post from 2010.07.02 14:57). I can't understand why all developers (including MQ ) persistently ignore the timer. If we take into account that there are no official examples of multicurrency traders, then everything is clear with MQ in this matter, but why others persistently ignore OnTimer() for me personally remains a BIG mystery....
 
gisip:

I didn't write about that at all.

I wrote that MQL5 glitches and produces erroneous data with certain combinations of instruments.

For example: If EURJPY or EURGBP is overlaid on the EURUSD chart, everything is normal.

But if you overlay EURCAD, the data on the chart with an error, while in MQL4 this was not the case, there is no error.

Please provide an example with an error.
 
Renat:
Please give me an example with an error.
Well, I will not write everything here, it seems clear enough.
//--------- Option with MQL4 ---------
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Aqua

extern string InstrumentName = "EURCAD";
double Buffer[];
SetIndexBuffer(0,Buffer); // Assign array to buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style

while(i >= 0){//-- Moving from right to left (i.e. from the highest to the 0 bar which is still being formed) --
Buffer[i] = (iHigh(InstrumentName,0,i) + iClose(InstrumentName,0,i) + iLow(InstrumentName,0,i)) / 3;
i--;//-- next Bar
}//next (while)



//----------- Now almost the same variant in MQL5 --------
#property indicator_separate_window // Indic. is drawn in a separate window
#property indicator_buffers 1

#property indicator_plots 1
#property indicator_type1 DRAW_LINE
#property indicator_color1 Aqua

input string InstrumentName = "EURCAD";
double Buffer[];
int handle1;

copied=CopyClose(InstrumentName,0,0,CountBars,Buffer);

//--Now we throw on EURUSD.

//--It doesn't matter on which instrument we place the indicator, the chart should not change.
 
Please paste the code correctly, it makes it easier to understand.
MQL5.community - Памятка пользователя
MQL5.community - Памятка пользователя
  • 2010.02.23
  • MetaQuotes Software Corp.
  • www.mql5.com
Вы недавно зарегистрировались и у вас возникли вопросы: Как вставить картинку в сообщение на форуме, как красиво оформить исходный код MQL5, где находятся ваши Личные сообщения? В этой статье мы подготовили для вас несколько практических советов, которые помогут быстрее освоиться на сайте MQL5.community и позволят в полной мере воспользоваться доступными функциональными возможностями.
 
Rosh:
Please insert the code correctly, it makes it easier to understand.

//--------- Option with MQL4 ---------
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Aqua

extern string InstrumentName = "EURCAD";
double Buffer[];
int init()
{
SetIndexBuffer(0,Buffer); // Assign array to buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style
}
int start()
{
while(i >= 0){
Buffer[i] = (iHigh(InstrumentName,0,i) + iClose(InstrumentName,0,i) + iLow(InstrumentName,0,i)) / 3;
i--;//-- next Bar
}//next (while)
}


//----------- Now almost the same variant in MQL5 --------
#property indicator_separate_window // Indic. is drawn in a separate window
#property indicator_buffers 1

#property indicator_plots 1
#property indicator_type1 DRAW_LINE
#property indicator_color1 Aqua

input string InstrumentName = "EURCAD";
double Buffer[];
int OnInit()
{
{ IndicatorSetString(INDICATOR_SHORTNAME,InstrumentName);
SetIndexBuffer(0,Buffer,INDICATOR_DATA);
}

int OnCalculate(....)
{
copied=CopyClose(InstrumentName,0,0,0,CountBars,Buffer);
}
//--Now we throw it on EURUSD.

//--It doesn't matter on which instrument we place the indicator, the chart should not change.
 
Gisip, you should use code insertion using the "SRC" button...
 

Please make a reproducible example. That is, you need ready-made code that you can compile, throw on a chart and get results.

Without this, few people will understand what we are talking about.
 

I'll help those who are deprived of consciousness.

//----------- Now almost the same variant in MQL5 --------
#property  indicator_separate_window    // The indicator is drawn in a separate window
#property indicator_buffers 1

#property indicator_plots   1
#property indicator_type1   DRAW_LINE
#property indicator_color1  Aqua

input string InstrumentName = "EURCAD";
double Buffer[]; 
int OnInit() 
{
   IndicatorSetString(INDICATOR_SHORTNAME,InstrumentName);
   SetIndexBuffer(0,Buffer,INDICATOR_DATA);
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 copied;
int CountBars=rates_total;
  copied=CopyClose(InstrumentName,0,0,CountBars,Buffer);
  return(copied);
}
//--Now throw it to EURUSD.

//--It does not matter on which instrument we place the indicator, the chart should not change.

Ideally it shouldn't, but I have it squeaking with algorithms it appeared only on 1 TF on the other ones categorically showed emptiness .....

even after an hour of testing.....

and attempts to upload history