Trading libraries for MetaTrader 5

Special Offer!

Time Left to Buy:

Up to 25% OFF

Shopping cart

The cart is empty

MetaTrader 5

Top Rated Products MT5

350 $263 $ KTS poverty killer robot
Thato Modiba
4 5 6 Product
5 500 $4 125 $ Bonnitta EA MT5
Ugochukwu Mobi
4 5 3 Product
999 $749 $ AI Gen XII MT4
Denis Kurnev
5 5 2 Product

Binance Futures Library

binance-futures-library-logo-200x200-8612
400 $300 $

Free updates are included

We accept crypto: BTC, ETH, BCH and more...

30-Day Money Back Guarantee
100% Guarantee of Originality

Information

Libraries
MetaTrader 5
Hadil Mutaqin SE
1.53
5

Overview

The library is used to develop automatic trading on Binance Futures Market from MT5 platform.

  • Support Binance Futures USD-M and COIN-M
  • Support Testnet mode
  • Support all order types: Limit, Market, StopLimit, StopMarket, StopLoss and TakeProfit
  • Automatically display the chart on the screen

Usage:

1. Open MQL5 demo account

2. Download Header file and EA sample https://drive.google.com/uc?export=download&id=17fWrZFeMZoSvH9-2iv4WDJhcyxG2eW17

  • Copy BinanceFutures.mqh to folder \MQL5\Include
  • Copy BinanceFuturesEA-Sample.mq5 to folder \MQL5\Experts

3. Allow WebRequest from MT5 Tools menu >> Options >> Expert Advisors and add URL:

        https://fapi.binance.com

        https://dapi.binance.com

        https://testnet.binancefuture.com

4. Open any chart and attach BinanceFuturesEA-Sample to the chart


Binance Futures Library Functions:

This function must be called from the OnInit() function

      void init                                 
      (   
         string symbol,                   // symbol name
         string historicalData,           // historicalData: 1W = 1 week, 1M = 1 month, 3M = 3 months, 6M = 6 months, 1Y = 1 year
         string apiKey,                   // binance api key
         string secretKey,                // binance secret key
         bool   testnet = false           // testnet mode
      );


This function must be called from the OnTimer() function

      void getTickData(); 


This function must be called from the OnDeinit() function

      void deinit();                 


The function used to place order, returns orderId if successful, otherwise -1

      long order                      
      (
         ORDERTYPE orderType,             // enum ORDERTYPE: BUY_MARKET, SELL_MARKET, BUY_LIMIT, SELL_LIMIT, BUY_STOP, SELL_STOP, BUY_STOPLIMIT, SELL_STOPLIMIT 
         double    quantity,              // order quantity
         double    limitPrice = 0,     	  // order limitPrice
         double    stopPrice = 0,         // order stopPrice
         double    stopLossPrice = 0,     // stopLoss price
         double    takeProfitPrice = 0,   // takeProfit price
         string    timeInForce = "GTC",   // timeInForce: GTC, IOC, FOK, default GTC
         string    comment = ""           // order comment
      );


Set stoploss and takeprofit, returns true if successful, otherwise false     

      bool setSLTP                        
      (
         SIDE side,                       // enum SIDE: BUY, SELL
         double stopLossPrice,            // stopLoss price
         double takeProfitPrice           // takeprofit price
      );     


Cancel open orders, returns true if successful, otherwise false

      bool cancelOrder                    
      (
         long orderId = -1                // order Id, default -1 cancel all open orders
      );


Close open positions, returns true if successful, otherwise false

      bool closePosition                  
      (
         SIDE side = -1                   // enum SIDE: BUY, SELL, default -1 close all open positions
      );


Get exchange info, returns ExchangeInfo structure if successful

      void getExchangeInfo                
      (
         ExchangeInfo &exchangeInfo       // [out] ExchangeInfo structure
      );


Get orderbook, returns OrderBook structure array if successful

      void getOrderBook                   
      (
         OrderBook &orderBook[],          // [out] OrderBook structure array
         int limit = 5                    // limit: 5, 10, 20, 50, 100, default 5
      );      


Get open orders, returns OpenOrders structure array if successful

      void getOpenOrders                  
      (
         OpenOrders &openOrders[]         // [out] OpenOrders structure array
      );                                 


Get open positions, returns OpenPositions structure array if successful

      void getOpenPositions               
      (                               
         OpenPositions &openPositions[]   // [out] OpenPositions structure array 
      );


Get the number of open orders

      int ordersTotal                     
      (
         ORDERTYPE orderType = -1         // enum ORDERTYPE: BUY_LIMIT, SELL_LIMIT, BUY_STOP, SELL_STOP, BUY_STOPLIMIT, SELL_STOPLIMIT, default -1 the number of all open orders
      );   

 

Get the number of open positions

      int positionsTotal                  
      (
         SIDE side = -1                   // enum SIDE: BUY, SELL, default -1 the number of all open positions
      );          

  

Set leverage, returns true if successful, otherwise false

      bool setLeverage   
      (
         int leverage                     // leverage value
      ); 


Get available balance

      double getBalance(); 


Set hedge position mode, returns true if successful, otherwise false

      bool setHedgeMode();               


Set one-way position mode, returns true if successful, otherwise false

      bool setOneWayMode();         


Set isolated margin type, returns true if successful, otherwise false

      bool setIsolatedMargin();          


Set crossed margin type, returns true if successful, otherwise false

      bool setCrossedMargin();            


Example how to call Binance Futures Library from EA

#include <BinanceFutures.mqh>

input string Symbol         = "BTCUSDC"; 
input string HistoricalData = "1W";    
input string ApiKey         = "";      
input string SecretKey      = "";  

BinanceFutures b;

int OnInit()
{          
   b.init(Symbol,HistoricalData,ApiKey,SecretKey);
 
   return 0;
}

void OnTimer()
{
   b.getTickData(); 
}

void OnDeinit(const int reason)
{
   b.deinit();
}

void OnTick()
{ 


   // Place buy market order
   // b.order(BUY_MARKET,0.001);                        

   // Place buy limit order   
   // b.order(BUY_LIMIT,0.001,75000);              
   
   // Place buy stop order   
   // b.order(BUY_STOP,0.001,0,115000);                       
   
   // Place buy stoplimit order   
   // b.order(BUY_STOPLIMIT,0.001,110000,115000);  
 
 
   // Place sell market order 
   // b.order(SELL_MARKET,0.001);                         
   
   // Place sell limit order
   // b.order(SELL_LIMIT,0.001,115000);            
   
   // Place sell stop order
   // b.order(SELL_STOP,0.001,0,75000);                          
   
   // Place sell stoplimit order
   // b.order(SELL_STOPLIMIT,0.001,80000,75000);	


   // Cancel all open orders
   // b.cancelOrder();             			             
  
   // Close all open positions
   // b.closePosition();           			     	   
   
   // Set leverage to 10x
   // b.setLeverage(10);           				  	                     
   
   // Set crossed margin type
   // b.setCrossedMargin();        			     	              
   
   // Set isolated margin type
   // b.setIsolatedMargin();       			     	                 
   
   // Set hedge position Mode
   // b.setHedgeMode();            			     	                   
   
   // Set oneWay position Mode
   // b.setOneWayMode();           			                        
     
   // Get the number of all open orders
   // int ordTotal = b.ordersTotal();
      
   // Get the number of all open positions    
   // int posTotal = b.positionsTotal();

   // Get available balance
   // double balance = b.getBalance();              
      
      
/* // Get exchangeInfo data

   ExchangeInfo exchangeInfo;
   b.getExchangeInfo(exchangeInfo);
   
   double minQty       = exchangeInfo.minQty;
   double maxQty       = exchangeInfo.maxQty;
   double minNotional  = exchangeInfo.minNotional;
   int    qtyDigit     = exchangeInfo.qtyDigit;
   int    priceDigit   = exchangeInfo.priceDigit;
   int    contractSize = exchangeInfo.contractSize;
*/

   
/* // Get orderBook data

   OrderBook orderBook[];
   b.getOrderBook(orderBook);
   
   for(int i = 0; i < ArraySize(orderBook); i++)
   {
      double askPrice = orderBook[i].askPrice;
      double askQty   = orderBook[i].askQty;
      double bidPrice = orderBook[i].bidPrice;
      double bidQty   = orderBook[i].bidQty;
   } 
*/
   
      
/* // Get open orders

   OpenOrders openOrders[];
   b.getOpenOrders(openOrders);
   
   for(int i = 0; i < ArraySize(openOrders); i++)
   {
      bool closePosition = openOrders[i].closePosition;
      
      if(closePosition == false)
      {     
         long   orderId      = openOrders[i].orderId;                  
         string symbol       = openOrders[i].symbol;             
         string side         = openOrders[i].side;             
         string positionSide = openOrders[i].positionSide;    
         string type         = openOrders[i].type;            
         string status       = openOrders[i].status;          
         string timeInForce  = openOrders[i].timeInForce;     
         double price        = openOrders[i].price;           
         double stopPrice    = openOrders[i].stopPrice;       
         double avgPrice     = openOrders[i].avgPrice;        
         double origQty      = openOrders[i].origQty;         
         double executedQty  = openOrders[i].executedQty;
         ulong  time         = openOrders[i].time;     
      }     
   }          
*/  


/* // Get open positions

   OpenPositions openPositions[];
   b.getOpenPositions(openPositions);
   
   for(int i = 0; i < ArraySize(openPositions); i++)
   {
      string symbol           = openPositions[i].symbol;       
      string side             = openPositions[i].side;          
      string positionSide     = openPositions[i].positionSide;  
      double positionAmt      = openPositions[i].positionAmt; 
      double entryPrice       = openPositions[i].entryPrice;    
      double markPrice        = openPositions[i].markPrice;      
      double unRealizedProfit = openPositions[i].unRealizedProfit; 
      double liquidationPrice = openPositions[i].liquidationPrice; 
   }
*/
}     


30-Day Money Back Guarantee

If for any reason you do not like the purchased program, you can request a refund within 30 days from the date of purchase. You can also make an exchange for any other product at an equal cost or by paying the difference.
Simply send a request for refund or exchange with your order number by email: support@market-fx.pro.
Refund requests received more than 30 days after purchase will be rejected.

Email Us Now! Support is available 24/7
by Email: support@market-fx.pro

Do You Need Help?
Click Here To Start Live Chat

Contact Us

Image

Search