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

 

Note that 

#define OBJPROP_TIME1 300

#define OBJPROP_PRICE1 301

#define OBJPROP_TIME2 302

#define OBJPROP_PRICE2 303

#define OBJPROP_TIME3 304

#define OBJPROP_PRICE3 305


Are not showed in this post, you can find them by downloading the file.

 

Hello,


I believe there is a missing last  '}' in the SetIndexStyleMQL4 deffinition.


Thank you  for the article, really useful :)


Lucian

 
bool IsTesting()
bool MQLInfoInteger(MQL_TESTER)
bool IsTradeAllowed()
bool MQLInfoInteger(MQL_TRADE_ALLOWED)
bool IsVisualMode()
bool MQLInfoInteger(MQL_VISUAL_MODE)
Migrating from MQL4 to MQL5
Migrating from MQL4 to MQL5
  • www.mql5.com
Practical Application Of Databases For Markets Analysis Working with data has become the main task for modern software - both for standalone and network applications. To solve this problem a specialized software were created. These are Database Management Systems (DBMS), that can structure, systematize and organize data for their computer...
 
ENUM_TIMEFRAMES TFMigrate(int tf)
  {
   switch(tf)
     {
      case 0: return(PERIOD_CURRENT);
      case 1: return(PERIOD_M1);
      case 5: return(PERIOD_M5);
      case 15: return(PERIOD_M15);
      case 30: return(PERIOD_M30);
      case 60: return(PERIOD_H1);
      case 240: return(PERIOD_H4);
      case 1440: return(PERIOD_D1);
      case 10080: return(PERIOD_W1);
      case 43200: return(PERIOD_MN1);
      
      case 2: return(PERIOD_M2);
      case 3: return(PERIOD_M3);
      case 4: return(PERIOD_M4);      
      case 6: return(PERIOD_M6);
      case 10: return(PERIOD_M10);
      case 12: return(PERIOD_M12);
 //    case 16385: return(PERIOD_H1);
       case 16386: return(PERIOD_H2);
      case 16387: return(PERIOD_H3);
      case 16388: return(PERIOD_H4);
      case 16390: return(PERIOD_H6);
      case 16392: return(PERIOD_H8);
      case 16396: return(PERIOD_H12);
      case 16408: return(PERIOD_D1);
      case 32769: return(PERIOD_W1);
      case 49153: return(PERIOD_MN1);      
      default: return(PERIOD_CURRENT);
     }
  }
 

minefield


 

Hello,

This old article (may 2010, more than 11 years ago !) was one of the first trying to simplify the process of migrating a script/EA from MQL4 to MQL5. Meantime, the popular mql4compat.mqh has been created, and I just published a maintained version of mql4compat on github for people interested : https://github.com/eromawyn/mql4compat

GitHub - eromawyn/mql4compat: MQL4 to MQL5 compatibility library
GitHub - eromawyn/mql4compat: MQL4 to MQL5 compatibility library
  • github.com
MQL4 to MQL5 compatibility library. Contribute to eromawyn/mql4compat development by creating an account on GitHub.
 
Hi I am struggling with these functions (please see below) I keep on getting these errors. Please help resolve it. Functions
 
Samson Mthande Mashabane # :
Hi I am struggling with these functions (please see below) I keep on getting these errors. Please help resolve it.

A picture is good, but you need an MQL5 code. You need to insert the code using the button Code

 

There is incorrect information in section 19. The function

void HideTestIndicators(bool hide)

has an analogue in MQL5

void TesterHideIndicators(bool hide)
Документация по MQL5: Общие функции / TesterHideIndicators
Документация по MQL5: Общие функции / TesterHideIndicators
  • www.mql5.com
TesterHideIndicators - Общие функции - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

Hi Guys , thanks a stack for the great work.

I was having an issue getting fractals to work when converting from MT4 .. this helps by returning 0 instead of EMPTY_VALUE  .. hope this is the right place to post thanks

double iFractals4(string symbol,
                     int tf,
                     int mode,
                     int shift)
  {
   ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
   int handle=iFractals(symbol,timeframe);
   if(handle<0)
     {
      Print("The iFractals object is not created: Error",GetLastError());
      return(-1);
     }
   else
   {
   double buffer=CopyBufferMQL4(handle,mode-1,shift);
      if (buffer!=EMPTY_VALUE) return(CopyBufferMQL4(handle,mode-1,shift));
      else return(0);
      }
  }