Download MetaTrader 5

TFMigrate(tf);

To add comments, please log in or register
Yochanan Gerbi
608
Yochanan Gerbi 2010.12.24 12:22 

Hello freinds,

 

I tried to imigarte a MQL4 file to MQL% file and I use the good article at: https://www.mql5.com/en/articles/81.

 

There it uses the line: ENUM_TIMEFRAMES timef=TFMigrate(tf);

 

The compilre says: 'TFMigrate' - function is not defined.

 

What can I do?

 

Thanks
 

Migrating from MQL4 to MQL5
  • 2010.05.17
  • Sergey Pavlov
  • www.mql5.com
This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.
Automated-Trading
Admin
100926
Automated-Trading 2010.12.24 14:05  
crossy:

What can I do?

You can add the function:

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 your code.

The second way is to copy initmql4.mqh to MQL5\Include\ folder and add

#include <initmql4.mqh>
Yochanan Gerbi
608
Yochanan Gerbi 2010.12.25 19:11  
Automated-Trading:

You can add the function:

to your code.

The second way is to copy initmql4.mqh to MQL5\Include\ folder and add

Thanks Quantum,

 

I'm sure that there are many fixed  MQH files that include the collection of the all possible migrations. Can you attach it or maybe just give me the links of them.

 

Thanks 

Dimka-novitsek
2421
Dimka-novitsek 2012.08.30 15:54  
Спасибі! Дякую.
Nikita Babich
256
Nikita Babich 2014.04.05 16:24  
Thank you!
To add comments, please log in or register