Watch how to download trading robots for free
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

Binance Spot Library - library for MetaTrader 5

Hadil Mutaqin SE

Views:
432
Rating:
votes: 14
Published:
2021.05.30 05:04
Updated:
2021.05.31 02:58
\MQL5\Include\ \MQL5\Experts\

Usage:

- Buy or rent Binance Library from MQL5 market and move BinanceLib.ex5 from folder \MQL5\Scripts\Market to MQL5\Libraries

- Copy Binance.mqh header file to folder \MQL5\Include

- Copy BinanceEA-Sample.mq5 to folder \MQL5\Experts


Example how to call Binance Library from EA

#include <Binance.mqh>

string Symbol      = "BTCUSDT";  // Symbol name
string HistoryData = "1W";       // History data: 1W = 1 week, 1M = 1 month, 3M = 3 months, 6M = 6 months, 1Y = 1 year, All = Maximum data
string ApiKey      = "";         // Binance api key
string SecretKey   = "";         // Binance secret key

Binance binance; 

int OnInit()
{  
   binance.init(Symbol,HistoryData,ApiKey,SecretKey);        
   binance.showChart(); 

   /* How to get balance
        double balanceUSDT = binance.balance("USDT"); //function to get USDT balance
        double balanceBTC  = binance.balance("BTC");  //function to get BTC balance     
   */   

   /* How to call order function
   
      //--Order Buy Market BTCUSDT quantity 0.01 BTC--
          binance.orderBuyMarket("BTCUSDT"    // Symbol name
                                 ,0.01);      // Order quantity

      //--Order Sell Market BTCUSDT quantity 0.02 BTC--
          binance.orderSellMarket("BTCUSDT"    // Symbol name
                                  ,0.02);      // Order quantity
                                   
      //--Order Buy Limit BTCUSDT quantity 0.01 BTC limit price at 15500 USDT--
          binance.orderBuyLimit("BTCUSDT"    // Symbol name
                                ,0.01        // Order quantity
                                ,15500       // Limit price
                                ,"GTC");     // Time in force: GTC, IOC, FOK, default GTC  

      //--Order Sell Limit BTCUSDT quantity 0.02 BTC limit price at 25500 USDT--
          binance.orderSellLimit("BTCUSDT"    // 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()
{   
   /*
   int totalBuyLimit  = binance.totalBuyLimitOrders(Symbol());
   int totalSellLimit = binance.totalSellLimitOrders(Symbol());
   
   if(totalBuyLimit == 0) 
   {
      binance.orderBuyLimit(Symbol(),0.01,25500,"GTC");
   }
   
   if(totalSellLimit == 0) 
   {
      binance.orderSellLimit(Symbol(),0.01,30500,"GTC");
   }
   */
} 




    CFileSet CFileSet

    Extend of CFile class to work with the .set extension file which terminal will produce when the Input/Optimisation is saved.

    Volume Calculator Based on Risk To Reward Volume Calculator Based on Risk To Reward

    This EA can Calculate each trade volume base on received TP and SL Prices and Risk percent of account in each trade.

    Binance Futures Library Binance Futures Library

    Binance Futures Header file and EA sample.

    SCT - The Overall Percent Risk - MT5 SCT - The Overall Percent Risk - MT5

    Building good trading habits by seeing things in terms of percentage not in terms of money.