The library is used to develop automatic trading on Binance spot market from MT5 platform.
- Support all order types: Market, Limit and Stop Limit
- Automatically display the chart on the screen
Usage:
- Copy Binance.mqh header file to folder \MQL5\Include
- Copy BinanceEA-Sample.mq5 to folder \MQL5\Experts
https://github.com/LazellnetLabs/BinanceMT5/raw/main/BinanceHeaderFile.zip
- Example how to call Binance Library from EA
#include <Binance.mqh>
string Symbol = "BTCUSDC"; // Symbol name
string HistoryData = "1W"; // History data: 1W = 1 week ago, 1M = 1 month ago, 3M = 3 months ago, 6M = 6 months ago, 1Y = 1 year ago
string ApiKey = ""; // Binance api key
string SecretKey = ""; // Binance secret key
Binance binance(Symbol,HistoryData,ApiKey,SecretKey);
int OnInit()
{
binance.showChart();
/* How to call order function
//--Order Buy Market BTCUSDC quantity 0.01 BTC--
binance.orderBuyMarket("BTCUSDC" // Symbol name
,0.01); // Order quantity
//--Order Sell Market BTCUSDC quantity 0.02 BTC--
binance.orderSellMarket("BTCUSDC" // Symbol name
,0.02); // Order quantity
//--Order Buy Limit BTCUSDC quantity 0.01 BTC limit price at 15500 USDC--
binance.orderBuyLimit("BTCUSDC" // Symbol name
,0.01 // Order quantity
,15500 // Limit price
,"GTC"); // Time in force: GTC, IOC, FOK, default GTC
//--Order Sell Limit BTCUSDC quantity 0.02 BTC limit price at 25500 USDC--
binance.orderSellLimit("BTCUSDC" // Symbol name
,0.02 // Order quantity
,25500 // Limit price
,"GTC"); // Time in force: GTC, IOC, FOK, default GTC
*/
//-----------------------------------------------------------------------//
return 0;
}
void OnTimer()
{
binance.getTickData();
}
void OnDeinit(const int reason)
{
binance.deinit();
}
void OnTick()
{
}