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.

How to Send Automated Orders without any Amibroker Bridge Installation?

1 min read

This tutorial explores how to send Automated orders to the brokers using the Algomojo platform without any external Bridge Installation.

Usually a Trading Bridge an external application/dll will be used to convert Amibroker signals into Trading Orders. However now with the Amibroker 6.39 version onwards couple of newly introduced Internet functions (InternetSetHeaders, InternetSetAgent & InternetPostRequest) helps traders to send orders without any bridge installation.

Supported Amibroker Version : Amibroker 6.39 version or higher
Supported Brokers : Aliceblue, Tradejini, Zebu

Note: In case you don’t have access to Amibroker 6.39 version or higher still have to use Multi Broker Bridge in Algomojo to send automated orders for efficient transmission of orders.

Here is the Amibroker AFL Code to Send Automated Orders

//This code requires Amibroker Version 6.39 or higher 

_SECTION_BEGIN("Send Auotmated Orders without Any Algo Bridge Installation");

Version(6.39);

trigger = ParamTrigger("transmit order","Send order");
stgy_name = ParamStr("Strategy Name","Amibroker Chart");
user_apikey = ParamStr("user_apikey","86cbef19e7e61ccee91e497690d5814e"); //Enter your API key here
api_secret = ParamStr("api_secret","8e8b207de43446c65f379bf2145b62fc"); //Enter your API secret key here
s_prdt_ali = "NRML:NRML|BO:BO|CNC:CNC|CO:CO|MIS:MIS"; 
Tsym = ParamStr("Tsym","RELIANCE-EQ");
exch = ParamList("Exchange","NSE|BSE|NFO|CDS|MCX",0);
Ret = "DAY";
prctyp = ParamList("prctyp","MKT|L|SL|SL-M",0);
Pcode = ParamList("Pcode","NRML|BO|CNC|CO|MIS",0);
qty = Param("Quatity",100,0,100000,1);
AMO = "NO";

broker ="tj";
ver = "1.0"; 

EnableAlgo = ParamList("AlgoTrading","Disable|Enable",0); 
 
//Algomojo API data               
api_data ="{\"api_key\":"+ "\""+user_apikey+"\","+ "\"api_secret\":"+"\""+api_secret+"\","+"\"data\":"+"{\"stgy_name\":\""+stgy_name+"\",\"s_prdt_ali\":\""+s_prdt_ali+"\",\"Tsym\":\""+Tsym+"\",\"exch\":\""+exch+"\",\"Ttranstype\":\""+"B"+"\",\"Ret\":\""+Ret+"\",\"prctyp\":\""+prctyp+"\",\"qty\":\""+qty+"\",\"discqty\":\""+"0"+"\",\"MktPro\":\""+"NA"+"\",\"Price\":\""+"0"+"\",\"TrigPrice\":\""+"0"+"\",\"Pcode\":\""+Pcode+"\",\"AMO\":\""+AMO+"\"}}";


if(trigger AND EnableAlgo=="Enable")
{

_TRACE("Broker API Request : "+api_data);

headers = "Content-Type: application/json\r\n" +
          "Accept-Encoding: gzip, deflate\r\n"; // ALL headers in one string
          
//set the Headers all in once          
InternetSetHeaders(headers); 

//set the internet agent as Amibroker
InternetSetAgent("AmiBroker");

//Call the Broker API endpoint for PlaceOrder
ih = InternetPostRequest("https://"+broker+"api.algomojo.com/"+ver+"/PlaceOrder",api_data,1);



if( ih ) 
{ 
    while( ( resp = InternetReadString(ih ) ) != "" ) 
   { 
       _TRACE("Broker API Response : "+resp);
   } 
    
    InternetClose( ih ); 
} 
}

_SECTION_END();


_SECTION_BEGIN("Candle Plot with Axis");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

_SECTION_END();
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.

Metatrader 4 – Simple Expert Advisor for Algomojo Platform

f writing a simple expert advisor for Metatrader 4 to send automated orders from MT4 to Algomojo - Cloud-Based Trading Platform. This tutorial provides...
Rajandran R
1 min read

How to Automate your Strategy just by Adding Two…

Since the start of Algomojo, we are focusing on one thing how to simplify the Automated Execution controls so that traders can easily convert...
Rajandran R
2 min read

Algomojo Platform Now Open to Firstock Users

We are proud to provide our Algomojo access to Firstock users. Firstock a Bangalore based discount broking firm partnered with Algomojo to provide algotraders...
Rajandran R
4 min read

Leave a Reply

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