Select Page

Note: Some steps in above video may be outdated, follow instructions below.

First follow the steps below to integrate your custom Expert Advisory. Also note that you need to edit the .mql4 EA file for auto trading. Download here required files for your custom EA algo setup.

Integrate your custom Expert Advisory.

  1. Firstly put ” Multiinstance.mqh” and “Algotrading.mqh”this file in Include folder of MT4 Data Folder.
  2. Then copy Paste this  [ #include < Multiinstance.mqh > ] in Expert Advisor just after initialization of data variables in Expert Advisor file.
  3. Search “OrderSend” Function and if OrderSend function Contain “OP_BUY” then Copy & Paste ” LongEntry(Quantity,Ask); ” after “OrderSend” Function declaration.
  4. Again Search “OrderSend” Function and if OrderSend Function Contain “OP_SELL” then Copy & Paste ” ShortEntry (Quantity,Ask); ” after “OrderSend” Function declaration.
  5. Now Search “OrderClose” Function and if OrderClose Function Contain “Bid” then Copy & Paste ” else { if(K==0){ (Quantity,Ask); } } ” after “OrderClose” Function declaration.
  6. Again Search “OrderClose” Function and if OrderClose Function Contain “Ask” then Copy & Paste ” else { if(K==0){ (Quantity,Ask);} } ” after “OrderClose” Function declaration.
  7. Search “OrderModify” Function and if OrderModify Function Contain “Bid” then Copy & Paste ” else { if(K==0){ LongExit (Quantity,Ask); } } ” after “OrderModify” Function declaration.
  8. Search “OrderModify” Function and if OrderModify Function Contain “Ask” then Copy & Paste ” else { if(K==0){ ShortExit (Quantity,Ask); } } ” after “OrderModify” Function declaration.

Note: Some Expert advisor Doesn’t have “OrderModify” Function then just ignore 7th and 8th Point.

After this Editing..

First Compile ” Multiinstance.mqh” this file

Using Custom Expert Advisor for Algo in MT4

You will get these three-external input in your strategy

Strategy tag- this should be same as symbol setting in API Bridge.

Port- If you are trading in multiple accounts of API Bridge then differentiate port number like this- “30001,30002”. And if you are trading in only one instance then leave it without change. See here more details on trading in multiple accounts.

Order type- here you can set the order type of your order  Market,Limit,SLL,SLM

three-external input in your strategy

Do you want coding help to deploy your own strategy for live trading? Check our coding assistance.