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

To add comments, please log in or register
vietlh216
38
vietlh216  
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.

Carl Schreiber
Moderator
9933
Carl Schreiber  

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!

Marcin Madrzak
471
Marcin Madrzak  
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?

Marcin Madrzak
471
Marcin Madrzak  

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

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.

lucian M
9
lucian M  

Hello,


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


Thank you  for the article, really useful :)


Lucian

Kourosh Davallou
66307
Kourosh Davallou  
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...
Kourosh Davallou
66307
Kourosh Davallou  
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);
     }
  }
To add comments, please log in or register