Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

Algomojo Button Trading Expert Advisor for Metatrader 4 Platform

2 min read

Here is a video tutorial and button trading expert advisor code for MetaTrader 4 platform. You can use the expert advisor to send automated orders to the Algomojo Platform with just the click of the button.

How to Send Automated Orders to Metatrader 4 Platform

You have to follow the 6 steps to send automated orders

Step 1 : Make sure you have a trading account with Algomojo Partner Broker. If not get one. Login to your Algomojo Partner Broker Account. Currently Algmojo supports Aliceblue, Tradejini, Zebu & Enrich.

Step 2. Download and Install the Multi Broker Bridge

Step 3: Download the Algomojo Expert Advisor and Copy the Expert Advisor File AlgomojoButtons.ex4

Step 4: Open your Metatader 4 Platform and Goto File ->Open Data Folder->Open MQL4/Experts Folder->Paste the AlgomojoButtons.ex4 as shown below

Step 5: Configuring the Algomojo Expert Advisor

i)Drag and drop the Expert Advisor to the charts
ii)Enable Allow DLL Imports from the common menu of Expert Advisor Properties


iii)Set the API key and API Secret key that you receive from the Algomojo My API section . Now set the appropriate exchange (NSE,NFO, MCX..etc) and select the appropriate symbol, order details , enter the broker shortcode and API version and Enable_Algo = True and Press the OK Button

Step 6 : Press the Buy or Sell Button to send Automated orders from Metatrader 4 to MQL4 trading terminal and check out the same in the expert advisor log section

Watch this video tutorial to configure AlgmojoButtons Expert Advisor and Send Automated Orders to your broker account.

In case if you need any assistance kindly check with Algomojo Tech support team or send a email at support@algomojo.com

Download Algomojo MQL4 code

//+------------------------------------------------------------------+
//|                                              AlgomojoButtons.mq4 |
//|           Copyright 2020, Marketcalls Financial Services Pvt Ltd |
//|                                       https://www.marketcalls.in |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, Marketcalls Financial Services Pvt Ltd"
#property link      "https://www.marketcalls.in"
#property version   "1.00"
#property strict


//Algomojo Autotrading Modules

input string user_apikey = "xxxxxxxxxxxxxxxxxxxxxx"; //Enter your API key here
input string api_secretkey = "xxxxxxxxxxxxxxxxxxxxxx"; //Enter your API secret key here
input string s_prdt_ali = "BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML";
input string Tsym = "NIFTY20DECFUT"; //Symbol Name
input string exch = "NFO"; //Exchange
input string Ret = "DAY"; //Retention
input string prctyp = "MKT"; // Pricetype
input string Pcode = "MIS"; // Product Code
input int qty = 150; // Quantity
input string AMO = "NO"; //AMO Order
input string stgy_name = "Metatrader Strategy"; // Strategy Name
input string broker = "ab"; //Broker Short code ab - aliceblue, tj- tradejini, zb - zebu , en - enrich
input string ver = "1.0"; //API Version

string response;
string api_data;

#import "AMMT4BRIDGE.dll"
     string AMDispatcher(string api_key, string api_secret, string api_name, string api_data, string br_code, string version);
#import

extern bool Enable_Algo = false;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   //if(IsTesting())
     {
      string name;
      string heading[2]={"Buy","Sell"};
      int xc=5;
      int yc=30;
      int xsize = 750;
      int ysize = 150;
      for(int i=0;i<2;i++)
        {
         name=heading[i];
         ObjectCreate(0,name,OBJ_BUTTON,0,0,0);
         ObjectSetText(name,name,12,"Arial",clrWhite);
         ObjectSetInteger(0,name,OBJPROP_XSIZE,xsize);
         ObjectSetInteger(0,name,OBJPROP_XSIZE,ysize);
         ObjectSetInteger(0,name,OBJPROP_XDISTANCE,xc);
         ObjectSetInteger(0,name,OBJPROP_YDISTANCE,yc);
         ObjectSetInteger(0,name,OBJPROP_COLOR,clrWhite);
         if(i==0)
         {
         ObjectSetInteger(0,name,OBJPROP_BGCOLOR,clrGreen);
         }
         if(i==1)
         {
         ObjectSetInteger(0,name,OBJPROP_BGCOLOR,clrTomato);
         }
         yc+=20;
        }

     }
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  //Delete the Buttons
  string ButtonName;
  string heading[2]={"Buy","Sell"};
  for(int i=0;i<2;i++)
        {
         ButtonName=heading[i];
         ObjectDelete(ButtonName);
         }
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  }

//+------------------------------------------------------------------+
//| BuyOrder  function                                               |
//+------------------------------------------------------------------+  

  
void BuyOrder()
   {
  
     //Algomojo Place Buy Order


      api_data ="{\"stgy_name\":\""+stgy_name+"\",\"s_prdt_ali\":\""+s_prdt_ali+"\",\"Tsym\":\""+Tsym+"\",\"exch\":\""+exch+"\",\"Ttranstype\":\""+"S"+"\",\"Ret\":\""+Ret+"\",\"prctyp\":\""+prctyp+"\",\"qty\":\""+qty+"\",\"discqty\":\""+"0"+"\",\"MktPro\":\""+"NA"+"\",\"Price\":\""+"0"+"\",\"TrigPrice\":\""+"0"+"\",\"Pcode\":\""+Pcode+"\",\"AMO\":\""+AMO+"\"}";
         
      response=AMDispatcher(user_apikey, api_secretkey,"PlaceOrder",api_data,broker,ver);
      Print("api : " ,api_data);
      Print("Algomojo Sell Order response : " ,response);
      
      
    }


//+------------------------------------------------------------------+
//| SellOrder  function                                              |
//+------------------------------------------------------------------+    
    
void SellOrder()
   {
  
      //Algomojo Place Sell Order
      api_data ="{\"stgy_name\":\""+stgy_name+"\",\"s_prdt_ali\":\""+s_prdt_ali+"\",\"Tsym\":\""+Tsym+"\",\"exch\":\""+exch+"\",\"Ttranstype\":\""+"S"+"\",\"Ret\":\""+Ret+"\",\"prctyp\":\""+prctyp+"\",\"qty\":\""+qty+"\",\"discqty\":\""+"0"+"\",\"MktPro\":\""+"NA"+"\",\"Price\":\""+"0"+"\",\"TrigPrice\":\""+"0"+"\",\"Pcode\":\""+Pcode+"\",\"AMO\":\""+AMO+"\"}";
         
      response=AMDispatcher(user_apikey, api_secretkey,"PlaceOrder",api_data,broker,ver);
      Print("api : " ,api_data);
      Print("Algomojo Buy Order response : " ,response);
         
   
   
   }
  
   
  
  
  
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      string name="Buy";
      if(ObjectGetInteger(0,name,OBJPROP_STATE)==true)
        {
        if(Enable_Algo){
         //Algomojo Place Buy Order - Double the Quantity

         ObjectSetInteger(0,name,OBJPROP_STATE,false);
         BuyOrder();
         }
        }
      name="Sell";
      if(ObjectGetInteger(0,name,OBJPROP_STATE)==true)
        {
         if(Enable_Algo){
         //Algomojo Place Buy Order - Double the Quantity

         SellOrder();
         }
        }
     }
     
     
     
     
//---
 
  }
Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

Algomojo Button Trading Expert Advisor for Metatrader 4 Platform

Here is a video tutorial and button trading expert advisor code for MetaTrader 4 platform. You can use the expert advisor to send automated...
Rajandran R
2 min read

How to Send Orders from Metatrader 4 Expert Advisor…

This tutorial helps you to convert your Metatrader 4 expert advisor to send automated orders to the Algomojo Platform. Currently, Algomojo supported brokers are...
Rajandran R
1 min read

Algomojo Now Supports Multi-Client Trading with Amibroker, Metatrader, Python,…

Yes, from now onwards Multi-Account Execution from trading tools like Amibroker, Metatrader 4 and Metatrader 5, Ninjatrader 7, Ninjatrader 8, Excel is now possible...
Rajandran R
1 min read

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More