MT4 PHP Market order

easy direct connection to any MT4 and MT5 server

MT4 PHP Market order

function market()
{
    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 =  ".$qc->AccountBalance()."\n";
    $symbol = "EURUSD";
    $qc->Subscribe($symbol);
    while(java_is_null($qc->GetQuote($symbol)))
        sleep(1);
    $quote = $qc->GetQuote($symbol);
    echo "Bid = ".$quote->Bid." Ask = ".$quote->Ask."\n";
    $oc = new java("online.mtapi.mt4.OrderClient"$qc);
    $op = (new java("online.mtapi.mt4.Op"))->Buy;
    $order = $oc->OrderSend($symbol$op, 0.1, $quote->Ask, 0, 0, 0);
    echo "Opened ticket =  ".$order->Ticket."\n";
    echo "Press ENTER to exit...\n";
    $qc->Disconnect();
    $line = fgets(fopen ("php://stdin","r"));
}

Leave a Reply