Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1309

 
Thank you so much everyone who responded!!! I will try your options!
 
Alexey Viktorov:

If you do this enumeration

you could try writing it like this

You have, as always, offered the best way to solve my problem!

 
Alexey Viktorov:

Why convert to int? Because in mql5, starting from H1, the enumeration value is not equal to the number of minutes. And in my opinion, on the contrary will introduce a lot of confusion.

Your method seems to work too! Thank you!

 
Alexey Viktorov:

So? Do they have something different in the ENUM_TIMEFRAMES enumeration? Or is there a fear of running out of memory? I don't know how to bother with that...


ps; Ah how slow I am typing...)))) While I was typing one line, Kira27 typed so much......... And something I suspect this will be used in mql4.

IN MQL5 )))

 
Here's a script to try, it works)))
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   enum frame1 // перечисление именованных констант
     {
      m1  = (int)PERIOD_M1,
      m5  = (int)PERIOD_M5,
      m15 = (int)PERIOD_M15,
      m30 = (int)PERIOD_M30,
      h1  = (int)PERIOD_H1,
      h4  = (int)PERIOD_H4,
      d1  = (int)PERIOD_D1,
      W1  = (int)PERIOD_W1,
      MN1 = (int)PERIOD_MN1
     };
   double T = iHigh(NULL,(ENUM_TIMEFRAMES) d1,0);

   Alert("Frame= ", (ENUM_TIMEFRAMES)  d1," iHigh= ",T);

  }

the result is as follows Although the int value of the day in minutes is 1440. But it works, hih is correct.

 
Alexey Viktorov:

So? Do they have something different in the ENUM_TIMEFRAMES enumeration? Or is there a fear of running out of memory? I don't know how to bother with that...


ps; Ah how slow I am typing...)))) While I was typing a single line Kira27 typed wow......... And something I suspect this will be used in mql4.

Your way gives the same result)))

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   enum frame1 // перечисление именованных констант
     {
      m1  = PERIOD_M1,
      m5  = PERIOD_M5,
      m15 = PERIOD_M15,
      m30 = PERIOD_M30,
      h1  = PERIOD_H1,
      h4  = PERIOD_H4,
      d1  = PERIOD_D1,
      W1  = PERIOD_W1,
      MN1 = PERIOD_MN1
     };
 
   double T = iHigh(NULL,(ENUM_TIMEFRAMES) d1,0);
   
   Alert("Frame= ", (ENUM_TIMEFRAMES)  d1," iHigh= ",T);
  }

 
Kira27:

Your way gives the same result)))

I didn't doubt it :-)))

 
Hi there!

Please help me replace the function written in MQL4 with MQL5.

double iHig(datetime ds, datetime de)
  {
   //Alert(iBarShift(Symbol(),PERIOD_CURRENT,ds),"  ",ds);
   return
      High[
         iHighest(Symbol(),PERIOD_CURRENT,MODE_HIGH,
                  iBarShift(Symbol(),PERIOD_CURRENT,ds)-iBarShift(Symbol(),PERIOD_CURRENT,de)+1,
                  iBarShift(Symbol(),PERIOD_CURRENT,de)
                 )
          ];
  }

The problem is that in MQL5 there are no predefined variables High, and I don't know how or what to replace this variable with.

 
Sprut 185:
Hi all!

Please help me replace the function written in MQL4 with MQL5.

The problem is that in MQL5 there are no predefined variables High, and I don't know how or what to replace this variable with.

There is a time series in MQL5

iHigh,

iLow,

etc.

Help section: Access to timeseries and indicator data/
 
Kira27:

There are time series in MQL5

iHigh,

iLow,

etc.

Help section: Access to timeseries and indicator data/.
Thanks for the tip, didn't find it at first........ Turns out this variable is just under a different name.
Reason: