MT4 PHP History orders

easy direct connection to any MT4 and MT5 server

MT4 PHP History orders

require_once("http://localhost:8080/JavaBridge/java/Java.inc");
echo "Connecting to server...\n";
$qc = new java("online.mtapi.mt4.QuoteClient", 55967934, "ov2osqv""88.212.244.84", 1951);
$qc->Connect();
echo "Connected. AccountBalanc =  ".$qc->AccountBalance()."\n";
$now =  (new java("java.time.LocalDateTime"))->now();
$orders = $qc->DownloadOrderHistory($now->minusDays(30), $now->plusDays(1));
$deposit = 0;
$withdraw = 0;
$profit = 0;
$balance = 0;
foreach ($orders as $order)
{
    $balance += java_values($order->Profit);
    if($order->Type == "Balance")
    {
        if($order->Profit > 0)
            $deposit += java_values($order->Profit);
        else
            $withdraw += java_values($order->Profit);
    }
    else
        $profit += java_values($order->Profit);
    echo "$order->Ticket $order->Symbol $order->Type balance = $balance\n";
}
echo "deposit = $deposit;  withdraw = $withdraw; profit = $profit\n";
echo "Press ENTER to exit...\n";
fgets(fopen ("php://stdin","r"));
$qc->Disconnect();

Leave a Reply