How To Integrate MetaTrader 4 / MetaTrader 5 with Stoxxo Intelligent Trading Bridge

How To Integrate MetaTrader 4 / MetaTrader 5 with Stoxxo- Intelligent Trading Bridge

Stoxxo Intelligent Trading Trading Bridge plugin for MetaTrader is a very fast multi-threaded and asynchronous function call. This can handle more than 100 calls per second. Just start typing IB_ in Meta Editor and you can see all the available functions.

 Please follow the below steps to integrate with MetaTrader 4 or MetaTrader 5. Both are seamlessly supported by the Stoxxo- Intelligent Trading Bridge.

 

Step 1: Enabling DLL in MT 4 / MT 5.

  1. Start MetaTrader and Click on Tools > Options menu.

2. A new screen like below would open.

  • Now Click Expert Advisors
  • Tick Allow DLL imports
  • Click Ok

3. Close MetaTrader.

Step 2: Plugin Installation.

4. Click Options Button and then Select Settings and Plugin Installation.

5. Select MT4 / MT5 from the Left Navigation panel, then Tick Enable MetaTrader 4 / 5 Integration.

In most cases, Bridge will automatically select the MetaTrader Installation path. If you want, you can change this path as per your MT Installation.

Select the MetaTrader Library Path from the Dropdown. If there are multiple paths in the drop down, please follow the below step to check the MetaTrader Data Folder Path and select the matching entry.

If the path is not completely visible, then you can extend the Dropdown by using a mouse.

6. Finally, Click Configure and you will get a confirmation message.

7. Restart the MetaTrader and your plugin is installed and ready for use.

Include required for MQ4 Coding

For MQL Programmers, to call Orders or other functions in MQL, you need to include the below mentioned line in your Indicator / Expert Advisor.

#include IABMT.mqh

#include IB_MoAtia.mqh  

Sample MQ4

You can download Sample MQ4 files from https://algobaba.com

MetaTrader Functions Details.

After installing the Plugin, Below given functions will be accessible from the AmiBroker AFL editor.

//Other Functions

  1. bool IB_Ping();
  2. string IB_GetError(int RequestID);

//Margins

  1. double IB_AvailableMargin(string UserID);
  2. double IB_AvailableMarginCommodity(string UserID);

//Mapped Order API Functions

  1. int IB_MappedOrderSimple(string SourceSymbol, string TransactionType, double SignalLTP, string StrategyTag);
  2. int IB_MappedOrderMod(int SignalID, string TransactionType, string SourceSymbol, string OrderType, double TriggerPrice, double Price, int Quantity, double SignalLTP, string StrategyTag);
  3. int IB_MappedOrderAdv(int SignalID, string TransactionType, string SourceSymbol, string OrderType, double TriggerPrice, double Price, int Quantity, string Target, string StopLoss, string TrailingStoploss, double SignalLTP, string StrategyTag, string ProductType, string OptionsType);
  4. int IB_MappedOrderSch(int SignalID, string TransactionType, string SourceSymbol, string OrderType, double TriggerPrice, double Price, int Quantity, string Target, string StopLoss, string TrailingStoploss, double SignalLTP, string StrategyTag, string ProductType, string OptionsType, string ScheduleTime);

//Place Order Functions

  1. int IB_PlaceOrder(int UniqueID, string StrategyTag, string UserID, string Exchange, string Symbol, string TransactionType, string OrderType, string Validity, string ProductType, int Qty, double Price, double TriggerPrice, string ProfitValue, string StoplossValue, string SLTrailingValue, int DisclosedQuantity, double SignalLTP, string DataProvider);
  2. int IB_PlaceOrderAdv(int UniqueID, string StrategyTag, string UserID, string Exchange, string Symbol, string TransactionType, string OrderType, string Validity, string ProductType, int Qty, double Price, double TriggerPrice, string ProfitValue, string StoplossValue, string SLTrailingValue, int DisclosedQuantity, string DataProvider, string TgtTrailingValue, string BreakEvenPoint, double SignalLTP, string MaxLTPDifference, string PriceSpread, string TriggerSpread, int CancelIfNotCompleteInSeconds);

//Order Modification and Cancellation

  1. bool IB_ModifyOrder(int RequestID, int Qty, double Price, double TriggerPrice, string ProfitValue, string StoplossValue, string SLTrailingValue, string TgtTrailingValue, string BreakEvenPoint);
  2. bool IB_CancelOrExitOrder(int RequestID);

//Misc Functions

  1. bool IB_SquareOff(string UserID);
  2. bool IB_SquareOffAll();
  3. bool IB_SquareOffStrategy(string StrategyID);
  4. double IB_MTM(string UserID);

//Market Data Functions

  1. void IB_Subscribe(string Exchange, string Symbol, string DataProvider);
  2. double IB_LTP(string Exchange, string Symbol, string DataProvider);
  3. double IB_BID(string Exchange, string Symbol, string DataProvider);
  4. double IB_ASK(string Exchange, string Symbol, string DataProvider);
  5. void IB_FeedLTP(string Exchange, string Symbol, string DataProvider, double LTP, double BID, double ASK);

//Order Details Functions

  1. string IB_OrderID(int RequestID);
  2. string IB_LastOrderID(string UserID);
  3. string IB_OrderStatus(int RequestID);
  4. int IB_OrderQty(int RequestID);
  5. int IB_OrderFilledQty(int RequestID);
  6. double IB_OrderAvgPrice(int RequestID);
  7. bool IB_IsOrderOpen(int RequestID);
  8. bool IB_IsOrderCompleted(int RequestID);
  9. bool IB_IsOrderRejected(int RequestID);
  10. bool IB_IsOrderCancelled(int RequestID);

Check for MetaTrader Data Folder Path. (Only if Required)

This step is required if you have multiple MetaTrader installed of you had uninstalled and then installed multiple times.

  1. Select File > Open Data Folder from MetaTrader Menu
  2. This will open a folder; you only need to note the last path of Folder which looks like some alphanumeric characters. This path needs to be selected in MetaTrader Library Path.
  3. Note the text in the red rectangle, which needs to be selected while installing the plugin.

Leave a Reply

Your email address will not be published. Required fields are marked *