Discussion of article "Migrating from MQL4 to MQL5" - page 8

 

How will the MQL4 string of the following form sound?

spread_ =MarketInfo(Symbol(), MODE_SPREAD)*Point;

in MQL5?

Thanks in advance!

 
piv_:

How will the MQL4 string of the following form sound?

spread_ =MarketInfo(Symbol(), MODE_SPREAD)*Point;

in MQL5?

Thanks in advance!

roughly like this:

spread=SymbolInfoInteger(symbol,SYMBOL_SPREAD)*Point();
 
iStdOnArray() is missing :) Seems MT5 is the first autotrading platform which doesn't have basic statistic :) Trying to do something with MQL5 for a few days, but until now only various problems like I would be creating entire financial engineering warehouse.
 
I still don't understand how to replace predefined variables like High. Low, Ask, Cose, Open.... In which of the special functions should they be declared?
 
buh400:
I still don't understand how to replace predefined variables like High. Low, Ask, Cose, Open.... In which of the special functions should they be declared?
High, low, open, close - through CopyHigh(), CopyLow(), etc. Bid and ask - via SymbolInfoDouble(). - This is data retrieval. And you should declare arrays to which you will receive data (for Copy... functions) and variables for bid and ask values. Declare them in those functions where you want to get this data (you should not declare them at the global level, although you can). For example, if you want to receive data on each tick - in the OnTick() function. If at initialisation - OnInit(), etc. Read the documentation.
 
I read it, no enthusiasm to learn mcl5! I think that brokers will not give up MT4! Yes, and for my lifetime it will be enough! Just do not complicate mcl4! Please!
 
When compiling the code from section 17, namely where we declare constants, we get an error - 'MODE_MAIN' - enumerator identifier already defined.

 
buh400:
when compiling code from section 17,
Give the link from the online version of the help - https://docs.mql4.com/ru
Справочник MQL4 - Документация на MQL4
  • docs.mql4.com
Справочник MQL4 - Документация на MQL4
 
Rashid Umarov:
Give a link from the online version of the help - https://docs.mql4.com/ru

this code is from the article - migration from MQL4 to MQL5.

17. Технические индикаторы
Получение значений технических индикаторов в своих экспертах очень подробно рассмотрено в одноимённой статье. В этом справочнике представлен краткий способ обращения к стандартным индикаторам, которого вполне достаточно для получения результата расчёта в одной точке. Для реализации такого механизма, нам потребуется вспомогательная функция:

double CopyBufferMQL4(int handle,int index,int shift)
  {
   double buf[];
   switch(index)
     {
      case 0: if(CopyBuffer(handle,0,shift,1,buf)>0)
         return(buf[0]); break;
      case 1: if(CopyBuffer(handle,1,shift,1,buf)>0)
         return(buf[0]); break;
      case 2: if(CopyBuffer(handle,2,shift,1,buf)>0)
         return(buf[0]); break;
      case 3: if(CopyBuffer(handle,3,shift,1,buf)>0)
         return(buf[0]); break;
      case 4: if(CopyBuffer(handle,4,shift,1,buf)>0)
         return(buf[0]); break;
      default: break;
     }
   return(EMPTY_VALUE);
  }
и объявим следующие константы:
ENUM_MA_METHOD MethodMigrate(int method)
  {
   switch(method)
     {
      case 0: return(MODE_SMA);
      case 1: return(MODE_EMA);
      case 2: return(MODE_SMMA);
      case 3: return(MODE_LWMA);
      default: return(MODE_SMA);
     }
  }
ENUM_APPLIED_PRICE PriceMigrate(int price)
  {
   switch(price)
     {
      case 1: return(PRICE_CLOSE);
      case 2: return(PRICE_OPEN);
      case 3: return(PRICE_HIGH);
      case 4: return(PRICE_LOW);
      case 5: return(PRICE_MEDIAN);
      case 6: return(PRICE_TYPICAL);
      case 7: return(PRICE_WEIGHTED);
      default: return(PRICE_CLOSE);
     }
  }
ENUM_STO_PRICE StoFieldMigrate(int field)
  {
   switch(field)
     {
      case 0: return(STO_LOWHIGH);
      case 1: return(STO_CLOSECLOSE);
      default: return(STO_LOWHIGH);
     }
  }
//+------------------------------------------------------------------+
enum ALLIGATOR_MODE  { MODE_GATORJAW=1,   MODE_GATORTEETH, MODE_GATORLIPS };
enum ADX_MODE        { MODE_MAIN,         MODE_PLUSDI, MODE_MINUSDI };
enum UP_LOW_MODE     { MODE_BASE,         MODE_UPPER,      MODE_LOWER };
enum ICHIMOKU_MODE   { MODE_TENKANSEN=1,  MODE_KIJUNSEN, MODE_SENKOUSPANA, MODE_SENKOUSPANB, MODE_CHINKOUSPAN };
enum MAIN_SIGNAL_MODE{ MODE_MAIN,         MODE_SIGNAL };
 
I realised that this issue has already been brought up and I need to read another article:) My posts can be deleted