When I run back test on the zerodha pi, it gives me the total profit, total loss and profit percentage.

I would assume the profit percentage to be the total profit divided by the total cost which I’m assuming is the cost of 1 stock (but not sure which transaction it takes to determine the cost of the stock because the price of the stock may vary over the back test interval. I’m assuming it to be the maximum cost of the stock during the back test as it appears to be the most conservative).

However, the profit percentage that I see does not seem to be related at all to this formula.

For example in one back test, I see

total profit: 45

Total loss: -122

percent profit: -168

largest profit: 20.9

largest loss: -47.75

The approximate average cost of the stock during the transactions in the back test period is Rs. 620 while the maximum is 650.