You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
With do respect to all. Last few month, I try to create php code to convert mq4 to ex4. So I just wanna share what I've found.
$directory = ""; // Directory to put ex4
if(!is_dir($directory))
{
mkdir ($directory, 0777);
}
// Code to create mq4 file.
$stringData = ""; // MQ4 Code; Call from DB or static. Recommend call from DB because mq4 code may be contain "".
$myFile = $directory."/ExpertAdvisor.mq4";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $stringData);
fclose($fh);
// Code to create bat file
// $Recordset['code'] = Call from DB. Only contain " (inverted coma)
$ExeCode = "cd ".$directory."
metalang -q ".$Recordset['code'].$myFile.$Recordset['code'];
$myExe = "Robot.bat";
$Exe = fopen($myExe, 'w') or die("can't open file");
fwrite($Exe, $ExeCode);
fclose($Exe);
exec($myExe); // Code to run bat file. Bat file will execute $myFile.
unlink($myFile); // Delete file mq4.
unlink($myExe); // Delete bat file.
}
Note : 1. This topic similar with https://forum.mql4.com/31468#308317 my purpose here to make the topic much related and easy to search.
2. Only work on window platform(localhost/server). Linux is not my field.
P/ S : I'm new here, please forgive me if I'm make something wrong. :)
Thanks