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 Futures Library - library for MetaTrader 5

Hadil Mutaqin SE

Views:
550
Rating:
votes: 14
Published:
2021.05.30 12:57
\MQL5\Experts\ \MQL5\Include\

Usage:

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

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

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


Example how to call Binance Futures Library from EA

#include <BinanceFutures.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

BinanceFutures binance;

int OnInit()
{  
   binance.init(Symbol,HistoryData,ApiKey,SecretKey);        
   binance.showChart();
  
   //double balanceUSDT = binance.balance("USDT");    //--Check Balance
   //int leverage = binance.getLeverage();            //--Check Leverage
   //binance.setLeverage(10);                         //--Set Leverage 10
   //string marginType = binance.getMarginType();     //--Check Margin Type
   //binance.setCrossedMarginType();                  //--Set Crossed Margin Type
   //binance.setIsolatedMarginType();                 //--Set Isolated Margin Type    
   //string positionMode = binance.getPositionMode(); //--Check Position Mode  
   //binance.setHedgePositionMode();                  //--Set Hedge Position Mode
   //binance.setOneWayPositionMode();                 //--Set OneWay Position Mode
   
   /* 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,50500,"GTC");
   }
   
   if(totalSellLimit == 0) 
   {
      binance.orderSellLimit(Symbol(),0.01,75500,"GTC");
   }
   */
}



    Binance Spot Library Binance Spot Library

    Binance Spot Header file and EA sample.

    CFileSet CFileSet

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

    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.

    Amplitude (Minimum Maximum) Indicator Amplitude (Minimum Maximum) Indicator

    This Indicator will show the Amplitude [Minimum; Maximum] of a given period and can act as a substitute of the ATR indicator. The indicator can be used to observe volatility and the force of past swings, useful to determine excesses that will possibly be reversed or repeated, given that the user has knowledge to complement with volume or standard-deviation strategies. It is suggested a period of 55200 at M1 or 2400 at H1 (meaning 40 sessions of 23hs each), or any period that complements your strategy.