Hi,
I am trying to back test my strategy, at many point of time number of shares traded is very less like 1 or 2 shares.
My broker gives 20x leverage.
So the following are my settings
Initial Equity = 50000
Account margin = 5
in afl code I have given SetPositionSize(10,spsPercentOfEquity);
So that I will be using 10% of my total equity for every trade.
I expect that for a stock of 80.45 rs expected number of stocks has to be 10% of 50000 which is 5000 * 20 (leverage ) = 100000 for ever trade.
So for a stock price of 80.45 total share traded should be 1243. But I get some single digits or double digit shares.
100% of equity means your true equity (50000), i.e. without borrowing. To use leverage you must specify bigger position size. 200% is 2x leverage and so on. So to use 20x leverage you have to multiply position size by 20.
You need to be way more careful with your own setup and take proper attention to the details. In your new screenshot your account margin in Settings is set to 100. Do things slowly and properly.
AmiBroker just works and it works properly.
If your formula does not work it means errors on your end.