Upgrade old MT4 EA to new MT4 EA

shanmugapradeep

Corporal
Messages
88
I have an old EA for MT4. it has functions like

Code:
extern bool Example = TRUE;

int init() {

//remaining code
return (0);

}

int deinit() {

//remaining code
return (0);

}

int start() {

//remaining code
return (0);
}

And if i want to upgrade to latest code, can i just change the name

int init() => void OnInit()
int deinit() => Void OnDeinit
int start() => void OnTick()
extern => input

Code:
input bool Example = TRUE;
void OnInit() {

//remaining code
return (INIT_SUCCEEDED);

}

void OnDeinit(const int reason) {

//remaining code
return (0);

}

void OnTick() {

//remaining code
return (0);
}



Will this impact my EA functions and performance?
 
I have an old EA for MT4. it has functions like

Code:
extern bool Example = TRUE;

int init() {

//remaining code
return (0);

}

int deinit() {

//remaining code
return (0);

}

int start() {

//remaining code
return (0);
}

And if i want to upgrade to latest code, can i just change the name

int init() => void OnInit()
int deinit() => Void OnDeinit
int start() => void OnTick()
extern => input

Code:
input bool Example = TRUE;
void OnInit() {

//remaining code
return (INIT_SUCCEEDED);

}

void OnDeinit(const int reason) {

//remaining code
return (0);

}

void OnTick() {

//remaining code
return (0);
}



Will this impact my EA functions and performance?

Certainly, when transitioning your EA from MT4 to MT5, you'll need to make some changes, such as adjusting function names and using a different syntax for input parameters. However, these modifications shouldn't have a negative impact on your EA's functionality or performance.

Here's what you need to do in a more conversational manner:

Function Names:

In MT4, you have functions like init(), deinit(), and start().
In MT5, the equivalent functions are OnInit(), OnDeinit(const int reason), and OnTick(). So, you should update the function names to match the MT5 syntax, as you've mentioned.
Input Parameters:

In MT4, you use extern to declare input parameters (e.g., extern bool Example = TRUE;).
In MT5, you should use input instead (e.g., input bool Example = TRUE;).
By making these changes, you're essentially adapting your code to the MT5 syntax, which is necessary for it to work on the MT5 platform. The adjustments you've described won't negatively affect your EA's functions or performance. These are standard modifications needed when transitioning from MT4 to MT5 to ensure compatibility with the newer platform.
 
Back
Top