Compile mq4 to ex4 using php

 

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.

  1. Php Code

    $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.

    }

  2. Copy MetaLang.exe and paste into file your php directory. File MetaLang.exe from your meta trader directory.

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