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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Everything works fine on MQL4 without a timer.
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.
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 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 give me an example with an error.
//--------- 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 insert the code correctly, it makes it easier to understand.
#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.
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.
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