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?
You can add the function:
ENUM_TIMEFRAMES TFMigrate(int 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);
to your code.
The second way is to copy initmql4.mqh to MQL5\Include\ folder and add
to your code.
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.
Hi I am faced with the same problem ,
I copied initmql4.mqh to include folder and now compiler gives Error :
can't open "C:\Users\Reza\AppData\Roaming\MetaQuotes\Terminal\03EFA09D725A1F639868556764D11623\MQL5\include\initmql4.mqh" include file Please tell me what should I do ?
You can try to add it as a resource or just copy the code in the Mqh file to your EA.
Hi Marco vd Heijden
Thank you .
thanks for your response.
I don't want to copy this codes because I'm converting mq4 to mq5 and there is many errors and I don't want to make my codes very crowded. how resources are working ? Do you know why I'v got that error ?
I know that there are many errors but in order to solve it you have to be specific.
This means the code and the exact error.
Obviously can't open
Means that it is unable to locate the file.
We can not solve this by code examples, it is you who has to make sure that the compiler can find the file.
Furthermore i can see the 'TFMigrate' - function is not defined, this seems to be solved now.
But i do not see any other error you posted so unable to help further.