The formulas are given on the brokerage calculator page. You need to write a method to compute the charges given four variables 1. The segment, 2. buy price, 3. sell price and 4. quantity.
You can refer this thread for the formula and method I use to calculate the transaction charges. This can be used for live trades, paper trades as well as backtesting.
Also a point to note here is that when you backtest you need to account for the spread i.e. the difference between current available orders in market depth vs the LTP. What you get in OHLC or Tickdata is the LTP. If you were to place an order it never be at LTP.
Most traders miss this concept and hence they end up strategies which seem profitable on backtest but fail on live trading.
1. The segment,
2. buy price,
3. sell price and
4. quantity.
You can refer this thread for the formula and method I use to calculate the transaction charges. This can be used for live trades, paper trades as well as backtesting.
Also a point to note here is that when you backtest you need to account for the spread i.e. the difference between current available orders in market depth vs the LTP. What you get in OHLC or Tickdata is the LTP. If you were to place an order it never be at LTP.
Most traders miss this concept and hence they end up strategies which seem profitable on backtest but fail on live trading.