1. Go to this page and download the library: Download tarikhagustia/laravel-mt5 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tarikhagustia / laravel-mt5 example snippets
use Tarikhagustia\LaravelMt5\Entities\Trade;
use Tarikhagustia\LaravelMt5\LaravelMt5;
$api = new LaravelMt5();
$trade = new Trade();
$trade->setLogin(6000189);
$trade->setAmount(100);
$trade->setComment("Deposit");
$trade->setType(Trade::DEAL_BALANCE);
$result = $api->trade($trade);
use Tarikhagustia\LaravelMt5\Entities\User;
use Tarikhagustia\LaravelMt5\LaravelMt5;
$api = new LaravelMt5();
$user = new User();
$user->setName("John Due");
$user->setEmail("[email protected]");
$user->setGroup("demo\demoforex");
$user->setLeverage("50");
$user->setPhone("0856123456");
$user->setAddress("Sukabumi");
$user->setCity("Sukabumi");
$user->setState("Jawa Barat");
$user->setCountry("Indonesia");
$user->setZipCode(1470);
$user->setMainPassword("Secure123");
$user->setInvestorPassword("NotSecure123");
$user->setPhonePassword("NotSecure123");
$result = $api->createUser($user);
use Tarikhagustia\LaravelMt5\LaravelMt5;
$api = new LaravelMt5();
$user = $api->getTradingAccounts($login);
$balance = $user->Balance;
$equity = $user->Equity;
$freeMargin = $user->MarginFree;
use Tarikhagustia\LaravelMt5\LaravelMt5;
$api = new LaravelMt5();
// Get Closed Order Total and pagination
$total = $api->getOrderHistoryTotal($exampleLogin, $timestampfrom, $timestampto);
$trades = $api->getOrderHistoryPagination($exampleLogin, $timestampfrom, $timestampto, 0, $total);
foreach ($trades as $trade) {
// see class MTOrder
echo "LOGIN : ".$trade->Login.PHP_EOL;
echo "TICKET : ".$trade->Order.PHP_EOL;
}
use Tarikhagustia\LaravelMt5\LaravelMt5;
$api = new LaravelMt5();
$api->dealerSend([
'Login' => 8113,
'Symbol' => 'XAUUSD',
'Volume' => 100,
'Type' => 0
});