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

 
Stanislav Korotky:

You can try the following addendum to my include:

After this your inital MQL4 code should work as is.


Now I understood how it work, Thanks Stanislav Korotky so much.

 

I would suggest to replace

string StringConcatenate(..);

by

string StringFormat("",..);

Both functions return a string which makes it easier to replace it under certain conditions!

 
Stanislav Korotky:

You can try the following addendum to my include:

After this your inital MQL4 code should work as is.

I added class OBJPROP_DOUBLE_BROKER_EXTENDED to your ind4to5 include and it seems not to be working as in the latest Metaeditor build 1958 call of ObjectSetDouble(chart_ID,name,OBJPROP_PRICE1,price1) returns compilation error 'ObjectSetDouble' - no one of the overloads can be applied to the function call. Any ideas?

 

I figured out myself that ObjectSetDouble was not included in ind4to5. I added the following code to mqh and it solved the problem.

bool ObjectSetDouble(long chart_id, const string name, const OBJPROP_DOUBLE_BROKER &property, const double value)
{
  return ObjectSetDouble(chart_id, name, property.p, property.i, value);
}
 

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);
     }
  }
 

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