Home Finance Angel Broking Multi-Client Amibroker Trading Module

Angel Broking Multi-Client Amibroker Trading Module

32
0

There is a frequent requirement from the clients of Angel Broking to automate the Amibroker based trading system where one generation from the chart can punch orders across multiple accounts (friends and family). Here is a readymade execution module that can be plugged in with your trading system to send multi orders under a single broker and configure multi-clients with ease.

Who can use this module?

Any trader who has and has access to Amibroker algomojo trading platform Can trigger your buy and sell signal generation across multiple accounts (friends and family) from your trading system. i.e. one Amibroker to fire orders across multiple accounts.

Which brokers are supported?

The current module supports Angel Broking only

How many accounts can one connect?

There is currently no restriction on the number of clients that can be connected.

Multi Client Account Control – AFL Coding Block

The multi-client account control block contains controls for configuring multiple clients, trading symbols, and configuring multiple trading accounts. If need to add more customers here is the sample format. Client details need to be configured to send multiple client accounts.

_SECTION_BEGIN("Multi Client Account Controls - Algomojo");

TotalAccounts = Param("Total Accounts",4,1,25,1);
TradingSymbol = ParamStr("TradingSymbol","RELIANCE-EQ");
Token = ParamStr("Token","2885"); //token is a mandatory parameter can be obtained from Symbol Details from Algomojo Watchlist 
Broker = Paramlist("Broker","an",0);  //Broker Short Code ab - aliceblue, tj - tradejini, zb - zebu, mt-mastertrust, en- enrich


//Client 1 Details
ClientId1 = ParamStr("ClientId1","K190553");
ApiKey1 =  ParamStr("ApiKey1","b48e4db30e47326722a388c03eb4ee26");
ApiSecret1 =  ParamStr("ApiSecret1","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity1 = ParamStr("Quantity1","5");


//Client 2 Details
ClientId2 = ParamStr("ClientId2","K190553");
ApiKey2 =  ParamStr("ApiKey2","b48e4db30e47326722a388c03eb4ee26");
ApiSecret2 =  ParamStr("ApiSecret2","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity2 = ParamStr("Quantity2","10");


//Client 3 Details
ClientId3 = ParamStr("ClientId3","K190553");
ApiKey3 =  ParamStr("ApiKey3","b48e4db30e47326722a388c03eb4ee26");
ApiSecret3 =  ParamStr("ApiSecret3","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity3 = ParamStr("Quantity3","15");


//Client 4 Details
ClientId4 = ParamStr("ClientId4","K190553");
ApiKey4 =  ParamStr("ApiKey4","b48e4db30e47326722a388c03eb4ee26");
ApiSecret4 =  ParamStr("ApiSecret4","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity4 = ParamStr("Quantity4","25");



_SECTION_END();

Chart Based Multi Client Trading Module

This module is a readymade module that can be integrated with Amibroker based trading systems already configured for Buy, Sell, Short, Cover conditions.


//Single Broker - Multi Client Algomojo Trading AFL
//Coded by Rajandran R - Co-Founder - Algomojo / Founder - Marketcalls
//Version 1.0
//Date : 02nd May 2021
//Website : www.algomojo.com / www.marketcalls.in

_SECTION_BEGIN("Multi Client Account Controls - Algomojo");

TotalAccounts = Param("Total Accounts",4,1,25,1);
TradingSymbol = ParamStr("TradingSymbol","RELIANCE-EQ");
Token = ParamStr("Token","2885"); //token is a mandatory parameter can be obtained from Symbol Details from Algomojo Watchlist 
Broker = Paramlist("Broker","an",0);  //Broker Short Code ab - aliceblue, tj - tradejini, zb - zebu, mt-mastertrust, en- enrich


//Client 1 Details
ClientId1 = ParamStr("ClientId1","K190553");
ApiKey1 =  ParamStr("ApiKey1","b48e4db30e47326722a388c03eb4ee26");
ApiSecret1 =  ParamStr("ApiSecret1","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity1 = ParamStr("Quantity1","5");


//Client 2 Details
ClientId2 = ParamStr("ClientId2","K190553");
ApiKey2 =  ParamStr("ApiKey2","b48e4db30e47326722a388c03eb4ee26");
ApiSecret2 =  ParamStr("ApiSecret2","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity2 = ParamStr("Quantity2","10");


//Client 3 Details
ClientId3 = ParamStr("ClientId3","K190553");
ApiKey3 =  ParamStr("ApiKey3","b48e4db30e47326722a388c03eb4ee26");
ApiSecret3 =  ParamStr("ApiSecret3","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity3 = ParamStr("Quantity3","15");


//Client 4 Details
ClientId4 = ParamStr("ClientId4","K190553");
ApiKey4 =  ParamStr("ApiKey4","b48e4db30e47326722a388c03eb4ee26");
ApiSecret4 =  ParamStr("ApiSecret4","fc3ed44d0914b0e6466f9ff2e3ae003a");
Quantity4 = ParamStr("Quantity4","25");



_SECTION_END();

_SECTION_BEGIN("Single Broker Multi Client Charting Module");


//Common Mapping
Exchange = ParamList("Exchange","NFO|NSE|BSE|CDS|MCX",1);  //Common Mapping
ordertype = ParamList("Order Type","MARKET|LIMIT|STOPLOSS_LIMIT|STOPLOSS_MARKET",0);
producttype = ParamList("Product Type","DELIVERY|CARRYFORWARD|MARGIN|INTRADAY|AMO_MARGIN|AMO_DELIVERY|AMO_CARRYFORWARD",0);
variety = ParamList("variety","NORMAL|STOPLOSS|AMO",0); 
price = Param("Price",0,0,100000);
triggerprice = Param("triggerprice",0,0,100000);
squareoff = ParamStr("SqrOffvalue","0"); 
stoploss = ParamStr("SLvalue","0");
trailingStopLoss = ParamStr("trailingSL","0"); 
disclosedquantity = 0;
duration = ParamStr("Duration","DAY");

ver = ParamStr("API Version","1.0");
tradedelay = Param("Execution Delay",0,0,1); // 0 - Execution with No Delay after a signal, 1- Execution at the end of the candle
stgy_name = ParamStr("Strategy Name","Multi Broker Execution"); // Strategy Name
EnableAlgo = ParamList("Algo Mode","Disable|Enable|LongOnly|ShortOnly",0); // Algo Mode



//Initialization
resp = "";


//Configure Trade Execution Delay


AlgoBuy = lastvalue(Ref(Buy,-tradedelay));
AlgoSell = lastvalue(Ref(Sell,-tradedelay));
AlgoShort = lastvalue(Ref(Short,-tradedelay));
AlgoCover = lastvalue(Ref(Cover,-tradedelay));






//Static Varibales for Order Protection

static_name_ = Name()+GetChartID()+interval(2)+stgy_name;
static_name_algo = Name()+GetChartID()+interval(2)+stgy_name+"algostatus";
//StaticVarSet(static_name_algo, -1); 


//Algo Dashboard

GfxSelectFont( "BOOK ANTIQUA", 14, 100 );
GfxSetBkMode( 1 );
if(EnableAlgo == "Enable")
{
AlgoStatus = "Algo Enabled";
GfxSetTextColor( colorGreen ); 
GfxTextOut( "Algostatus : "+AlgoStatus , 20, 40); 
if(Nz(StaticVarGet(static_name_algo),0)!=1)
{
_TRACE("Algo Status : Enabled");
StaticVarSet(static_name_algo, 1);
}
}
if(EnableAlgo == "Disable")
{
AlgoStatus = "Algo Disabled";
GfxSetTextColor( colorRed ); 
GfxTextOut( "Algostatus : "+AlgoStatus , 20, 40); 
if(Nz(StaticVarGet(static_name_algo),0)!=0)
{
_TRACE("Algo Status : Disabled");
StaticVarSet(static_name_algo, 0);
}
}
if(EnableAlgo == "LongOnly")
{
AlgoStatus = "Long Only";
GfxSetTextColor( colorYellow ); 
GfxTextOut( "Algostatus : "+AlgoStatus , 20, 40); 
if(Nz(StaticVarGet(static_name_algo),0)!=2)
{
_TRACE("Algo Status : Long Only");
StaticVarSet(static_name_algo, 2);
}
}
if(EnableAlgo == "ShortOnly")
{
AlgoStatus = "Short Only";
GfxSetTextColor( colorYellow ); 
GfxTextOut( "Algostatus : "+AlgoStatus , 20, 40); 
if(Nz(StaticVarGet(static_name_algo),0)!=3)
{
_TRACE("Algo Status : Short Only");
StaticVarSet(static_name_algo, 3);
}
}

function apidata(Accounts,Action,multiplier){


	head = "{"orders" : [";
	tail = "  ]}";
	body = "";
	
	
	for(i=1;i

Feel free to modify the code according to your needs. Use this module responsibly!
Test your system properly with the module before using the module in a live automation trading environment.

Disclaimer: The opinions expressed within this article are the personal opinions of the author. The facts and opinions appearing in the article do not reflect the views of knews.uk and knews.uk does not assume any responsibility or liability for the same.

For latest entertainment news| health news| political news| sports news| travel news| Covid-19 news| Tech news| Digital Marketing| Lyrics

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.