This tutorial explores how to build your very first execution module in Amibroker and How to transmit orders from Amibroker to Algomojo trading platoform.
What is a Execution Logic?
Traders who want to automate their Buy and Sell logic they often needs to decide how they want to execute their orders or automate their orders that they are sending to their broker server.
Here a simple button based control is discussed where with a press of the button order gets punched automatically to your broker sever.
What is a Algomojo Bridge?
Algmojo comes with Multi Broker Bridge which provides access to send your automated orders from Amibroker to your broker server
What is AM Dispatcher?
AM Dispatcher is a simple function inside Algomojo Multi Broker Bridge which transports the data from Amibroker to your broker server.

Requirements
Amibroker 5.9 or above version.
Algomojo Trading Account + Algomojo API Credentials
Algomojo Multi Broker Bridge
Building your First Execution Module
Here is a video tutorial where I explained how to create Amibroker Execution module right from the scratch.
Simple Execution Module – Amibroker AFL
_SECTION_BEGIN("Simple Execution Module");
SetChartOptions(0, chartShowArrows | chartShowDates); //x-Axis will be plottted
//plot the candles
Plot(Close,"Close",colorDefault,GetPriceStyle() | styleNoTitle);
apikey = ParamStr("user_apikey","86cbef19e7e61ccee91e497690d5814e"); //Enter your API key here
apisecret = ParamStr("api_secret","6d5acaca5714131814125f8216098782"); //Enter your API secret key here
broker = ParamStr("Broker","tj"); //Broker Short Code - ab - aliceblue, tj - tradejini, zb - zebu, en - enrich, an - angel broking, up - upstox
ver = ParamStr("API Version","1.0");
trigger = ParamTrigger("PlaceOrder","Send Order");
if(trigger)
{
//send order to the broker
api_data = "{
\"strg_name\":\"Test Strategy\",
\"s_prdt_ali\":\"BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML\",
\"Tsym\":\"LUPIN-EQ\",
\"exch\":\"NSE\",
\"Ttranstype\":\"B\",
\"Ret\":\"DAY\",
\"prctyp\":\"MKT\",
\"qty\":\"100\",
\"discqty\":\"0\",
\"MktPro\":\"NA\",
\"Price\":\"0\",
\"TrigPrice\":\"0\",
\"Pcode\":\"MIS\",
\"AMO\":\"NO\"
}";
algomojo=CreateObject("AMAMIBRIDGE.Main");
response = algomojo.AMDispatcher(apikey,apisecret,"PlaceOrder",api_data,broker,ver);
_TRACE("Broker Server Response : "+ response);
}
_SECTION_END();
Building your First Cover Order Execution Module using Amibroker and Creating Execution Controls
Simple Cover Order Execution Module – Amibroker AFL
_SECTION_BEGIN("Simple Cover Order Module");
SetChartOptions(0, chartShowArrows | chartShowDates); //x-Axis will be plottted
//plot the candles
Plot(Close,"Close",colorDefault,GetPriceStyle() | styleNoTitle);
apikey = ParamStr("user_apikey","86cbef19e7e61ccee91e497690d5814e"); //Enter your API key here
apisecret = ParamStr("api_secret","6d5acaca5714131814125f8216098782"); //Enter your API secret key here
broker = ParamStr("Broker","tj"); //Broker Short Code - ab - aliceblue, tj - tradejini, zb - zebu, en - enrich, an - angel broking, up - upstox
ver = ParamStr("API Version","1.0");
symbol = ParamStr("Symbol Name","RELIANCE-EQ");
stoplevel = Param("Stop Levels",1900,1,10000,1);
trigger = ParamTrigger("PlaceOrder","Send Order");
if(trigger)
{
//send order to the broker
api_data = "{
\"strg_name\":\"Test Strategy\",
\"s_prdt_ali\":\"BO:BO||CNC:CNC||CO:CO||MIS:MIS||NRML:NRML\",
\"Tsym\":\""+symbol+"\",
\"exch\":\"NSE\",
\"Ttranstype\":\"B\",
\"Ret\":\"DAY\",
\"prctyp\":\"MKT\",
\"qty\":\"100\",
\"discqty\":\"0\",
\"MktPro\":\"NA\",
\"Price\":\"0\",
\"TrigPrice\":\""+stoplevel+"\",
\"Pcode\":\"CO\",
\"AMO\":\"NO\"
}";
//Create the object to access the algomojo bridge
algomojo=CreateObject("AMAMIBRIDGE.Main");
//sending the data using AM Dispatcher to the broker server
response = algomojo.AMDispatcher(apikey,apisecret,"PlaceOrder",api_data,broker,ver);
_TRACE("Broker Server Response : "+ response);
}
_SECTION_END();
Now with a click of the Send Order button you should be able to test your orders during live market. See you in the next tutorial with even concepts on building your automated trading using algomojo platform.