Completed some long pending issue today. Compute out the actual costs of trading and get accurate number to feed to the Amibroker Backtester
For a long time, I have realized that taxation component in non dabba trading was bigger than the brokerage being levied but never got around to pinning down the actual multiple
Here is the AFL snippet in all its glory....
With my regular brick&Mortar office Brokerage house .... Cost 2 Brokerage ratio is 2.2
With discounted brokers with no office in my area Cost 2 Brokerage ratio is 6.99
For a long time, I have realized that taxation component in non dabba trading was bigger than the brokerage being levied but never got around to pinning down the actual multiple
Here is the AFL snippet in all its glory....
Code:
numlots = Param("Traded Number of Lots", 1, 1, 1000000, 1);
lotSize = Param("Quantity in Single lot", 1, 1, 1000000, 1);
brokeragePercentage = Param("Brokerage (Percentage)", 0.01 , 0.0001, 0.5, 0.0001) / 100;
gstRatePercentage = Param("GST Rate (Percentage)", 18 , 0.1, 100, 0.1) / 100;
securityTxnPercentage = Param("S.T.Tax (Percentage)", 0.01 , 0.0001, 0.5, 0.0001) / 100;
exhangeChargesPerecntage = Param("Exch.Fees (Percentage)", 0.0019 , 0.0001, 0.5, 0.0001) / 100;
clearingChargePercentage = Param("Clearing (Percentage)", 0.0002 , 0.0001, 0.5, 0.0001) / 100;
SEBIChargePercentage = Param("SEBI Fees (Percentage)", 0.00015, 0.0001, 0.5, 0.0001) / 100;
StampDutyPercentage = Param("StampDuty (Percentage)", 0.003 , 0.0001, 0.5, 0.0001) / 100;
purchasePrice = Open; /// Substitute your field or arrays here
sellinngPrice = Close; /// Substitute your field or arrays here
buyyTurnover = numlots * lotSize * purchasePrice;
sellTurnover = numlots * lotSize * sellinngPrice;
totlTurnover = buyyTurnover + sellTurnover;
brkrgAmount = totlTurnover * brokeragePercentage;
secrtTrxnTax = sellTurnover * securityTxnPercentage;
exchangeFees = totlTurnover * exhangeChargesPerecntage;
goodNServTax = (brkrgAmount + exchangeFees) * gstRatePercentage;
clearingFees = totlTurnover * clearingChargePercentage;
SEBI_Charges = totlTurnover * SEBIChargePercentage;
stampDuty = totlTurnover * StampDutyPercentage;
totalCost = brkrgAmount + goodNServTax + secrtTrxnTax + exchangeFees + clearingFees + SEBI_Charges + stampDuty;
breakevenCost = totalCost / (numlots * lotSize);
Cost2Brkrg = totalCost / brkrgAmount;
AmibrokerCost = 100 * (totalCost / totlTurnover);
//AmibrokerCost = Cost2Brkrg * 100 * brokeragePercentage;
_TRACE("" + AmibrokerCost);
With my regular brick&Mortar office Brokerage house .... Cost 2 Brokerage ratio is 2.2
With discounted brokers with no office in my area Cost 2 Brokerage ratio is 6.99
Last edited: