Questions from Beginners MQL5 MT5 MetaTrader 5 - page 700

 
Vitalie Postolache:
Urgent to real!!!!!!!!!!!!!
not so urgent, a copy to me first)
 
Treder9:
I'd like to get a real one for 50 bucks myself.

You can get a good rise out of a quid like that.

♪ but no one can do it ♪

I answer!
 
Taras Slobodyanik:

You need to add a parameter

request.type_time=ORDER_TIME_DAY;


Thank you, I just wish I could figure out how to add...

 

I can't figure out how to express High[] in five???

double High[]
double High[];
int count;        // сколько копируем
ArraySetAsSeries(High,true);
CopyHigh(_Symbol,_Period,0,count,High);
 
-Aleks-:

I can't figure out how to express High[] in 5???

I express it this way, it may not be written correctly, but it works:

double iOpen(string symb,ENUM_TIMEFRAMES tf,int index) {
if(symb=="0") { symb=Symbol();}
  double _Open[];
  double open=0;
   ArraySetAsSeries(_Open,true);
   int copied=CopyOpen(symb,tf,0,Bars(symb,tf),_Open);
   if(copied>0 && index<copied) open=_Open[index];
   return(open);
}
double iClose(string symb,ENUM_TIMEFRAMES tf,int index) {
if(symb=="0") { symb=Symbol();}
  double _Close[];
  double close=0;
   ArraySetAsSeries(_Close,true);
   int copied=CopyClose(symb,tf,0,Bars(symb,tf),_Close);
   if(copied>0 && index<copied) close=_Close[index];
   return(close);
}
double iHigh(string symb,ENUM_TIMEFRAMES tf,int index) {
if(symb=="0") { symb=Symbol();}
  double _High[];
  double high=0;
   ArraySetAsSeries(_High,true);
   int copied=CopyHigh(symb,tf,0,Bars(symb,tf),_High);
   if(copied>0 && index<copied) high=_High[index];
   return(high);
}
double iLow(string symb,ENUM_TIMEFRAMES tf,int index) {
if(symb=="0") { symb=Symbol();}
  double _Low[];
  double low=0;
   ArraySetAsSeries(_Low,true);
   int copied=CopyLow(symb,tf,0,Bars(symb,tf),_Low);
   if(copied>0 && index<copied) low=_Low[index];
   return(low);
}
 
-Aleks-:

I can't figure out how to express High[] in 5???

MqlRates rates[];
int copied=CopyRates(NULL,0,0,100,rates);


then, where needed, call: rates[x].high.
 
Vitaly Muzichenko:

I express it this way, it may not be written down correctly, but it works:

And I did - but why screw it up so badly in five....

Vitalie Postolache:

MqlRates rates[];
int copied=CopyRates(NULL,0,0,100,rates);


then, where necessary, call: rates[x].high.

And, what, as a rule, do people copy all the values? What's the advantage of this copying at all? Does it consume less memory than in 4?

Fell into a stupor from

It should be noted that in MQL5 numerical values of constants of chart periods (starting from H1) do not coincide with the number of minutes in a bar (for example, in MQL5 numerical value of PERIOD_H1=16385, while in MQL4 PERIOD_H1=60). This circumstance must be taken into account when transferring to MQL5, if numeric values for calculations have been used in the program in MQL4.

To know the number of minutes of a specified period of a chart, divide the value of the PeriodSeconds function by 60.

Where does the number 16385 come from - where is the logic?

 
Vitalie Postolache:

MqlRates rates[];
int copied=CopyRates(NULL,0,0,100,rates);


then where necessary to call: rates[x].high.

OK, you have a solution for the current character, I have a multisymbol retrieval.

Question: am I getting it right, or is there a bug in the code?

-Aleks-:

I am confused by

It should be noted that in MQL5 the numeric values of constants of chart periods (starting from H1) do not coincide with the number of minutes in a bar (for example, in MQL5 the numeric value of PERIOD_H1=16385, while in MQL4 PERIOD_H1=60). This circumstance must be taken into account when transferring to MQL5, if numeric values for calculations have been used in the program in MQL4.

To know the number of minutes of a specified period of a chart, divide the value of the PeriodSeconds function by 60.

Where does the number 16385 come from - where is the logic?

Must study quantum physics, that must be where the value comes from
 
-Aleks-:

So did I - but why screw it up so badly in the five....

And, what is it that people tend to copy all the values? What is the advantage of this copying at all? Does it consume less memory than in 4?

Why all? Complete information for 100 bars, at a time (of course, you can specify fewer or more bars). Useful when you need more than just High.

But it may be downloaded separately, asVitaly Muzichenko showed.

Vitaly Muzichenko:

Okay, you have the solution for the current symbol, I have a multisymbol acquisition.

Question: is it correct, or there is a bug in my code?

It's easy to "turn" this solution into a multisymbol one, just by specifying a character instead of NULL. Well, and TF, if necessary, just like in your examples.

Regarding code correctness, so there are examples in help(CopyHigh look), there just arrays on global level.

 
-Aleks-:

Falls into disarray .........

There's this.

It's a bit prickly at first. However, rewriting from MT4 is no problem.

I don't know about others, but 4-Rka thinks faster.

And what has been done on 4-Rka goes in the Market without any problem, while rewritten from MT4 to MT5 sometimes does not get through, just because the Market has no time to test an identical product in its allotted time.

Reason: