Questions from Beginners MQL5 MT5 MetaTrader 5 - page 626

 
Alexey Viktorov:


How clever of you, and so succinct. Thank you.

 
Karputov Vladimir:
This is a check to return the PositionGetDouble function. If it fails, it returns 0 - i.e. it's an error.

And I use the second form in Five, it seems more reliable to me.

 
Alexey Volchanskiy:

And I use the second form in the five, I think it's more reliable.

And in a loop.

do while(!PositiobGetDouble(POSITION_VOLUME, double_var);
I'm sure it won't slip past...
 

Stupid... :-)

How in the expert via iCustom (), refer to the values of the variables

double _Volume

и

int High_Low

of this indicator:

#property version   "1.00"
#property strict
#property indicator_chart_window
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
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[])
  {  
    long  Vol0 = iVolume(NULL,0,0);
    long  Vol1 = iVolume(NULL,0,1);
    long  Vol2 = iVolume(NULL,0,2);
    long  Vol3 = iVolume(NULL,0,3);
    long  Vol4 = iVolume(NULL,0,4);
    long  Vol5 = iVolume(NULL,0,5);
    long  Vol6 = iVolume(NULL,0,6);
    long  Vol7 = iVolume(NULL,0,7);
    long  Vol8 = iVolume(NULL,0,8);
    long  Vol9 = iVolume(NULL,0,9);
    long  Vol10= iVolume(NULL,0,10);

    double high1 = iHigh(NULL, 0, 1);
    double low1 =  iLow (NULL, 0, 1);    
    double high2 = iHigh(NULL, 0, 2);    
    double low2 =  iLow (NULL, 0, 2);
    double high3 = iHigh(NULL, 0, 3);    
    double low3 =  iLow (NULL, 0, 3);
    double high4 = iHigh(NULL, 0, 4);
    double low4 =  iLow (NULL, 0, 4);    
    double high5 = iHigh(NULL, 0, 5);    
    double low5 =  iLow (NULL, 0, 5);
    double high6 = iHigh(NULL, 0, 6);    
    double low6 =  iLow (NULL, 0, 6);
    double high7 = iHigh(NULL, 0, 7);
    double low7 =  iLow (NULL, 0, 7);    
    double high8 = iHigh(NULL, 0, 8);    
    double low8 =  iLow (NULL, 0, 8);
    double high9 = iHigh(NULL, 0, 9);    
    double low9 =  iLow (NULL, 0, 9);
    double high10 =iHigh(NULL, 0, 10);
    double low10 = iLow (NULL, 0, 10);    
    
    double _Volume = NormalizeDouble((Vol1+Vol2+Vol3+Vol4+Vol5+Vol6+Vol7+
                     Vol8+Vol9+Vol10)/10, _Digits);
    int High_Low = (int)((MathAbs(high1-low1)+MathAbs(high2-low2)+MathAbs(high3-low3)+
              MathAbs(high4-low4)+MathAbs(high5-low5)+MathAbs(high6-low6)+
              MathAbs(high7-low7)+MathAbs(high8-low8)+MathAbs(high9-low9)+
              MathAbs(high10-low10))/(10*Point));
   
   
   Alert(" Vol0 = ",Vol0,", Voll = ",Vol1,", Vol2 = ",Vol2,", Vol3 = ",Vol3,
     ", Vol4 = ",Vol4, ", Vol5 = ",Vol5, ", Vol6 = ",Vol6);
   Alert (" Vol7 = ",Vol7,", Vol8 = ",Vol8, ", Vol9 = ",Vol9, ", Vol10 = ",Vol10); 
   Alert("Cредний минутный объём за 10 мин. _Volume = ",_Volume);
   
   Alert("Среднее поминутное движение за 10 мин. High_Low = ",High_Low);  
   
  
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Roman Shiredchenko:

Stupid... :-)

How in expert via iCustom (), refer to the values of the variables

и

of this indicator:

You cannot do it directly. You should write the variable value in the indicator buffer and take it from there through iCustom
 
Andrey Barinov:
You can't do it directly. You have to write the value of variable in the indicator buffer and take it from there through iCustom

This is understandable... Maybe a short example for one variable and that's it... Although it looks like I'll find something in the help there myself...

Thank you. How to write them to the buffer, I mean what type of buffer to organize.... You don't need lines in this indicator...

 
How do I modify the magic number of a market order in MQL4?
 
Alexey Volchanskiy:

There is also an explicit type conversion:

Thank you! We'll take it under advisement.
 
new-rena:
How can I modify a market order magic number in MQL4?
Absolutely no, the same with comment. Only reopen with a different magic number
 
mila.com:

Hello.

Please advise how to solve the following problem.

An EA is trying to open a position and the server returns a requote.

Since there is no EA code, we need to find out from the outside that there was a requote and open the same position at any cost.

Only analyze log files such as \logs\20160922.log. But we cannot get them from MQL4/5, only \MQL5\Files folder is available for reading/writing.

So, we need to write an external script which will read the log, analyze it and inform MQL4/5 if a position needs to be opened.

Or it simply copies the log once per second to the Files folder, and from there it can be read and analyzed using MQL tools