I am new to this forum, and having just created my first backtest of the sample algorithm, I am finding it hard to trust the results. Where is the error here?
I am new to this forum, and having just created my first backtest of the sample algorithm, I am finding it hard to trust the results. Where is the error here?
Hi Jack,
The backtester allows unlimited borrowing, if you don't constrain it (have a look at your cash balance). So, you are borrowing well in excess of your $10,000 initial capital to fund the trading.
Grant
As Grant said the sample algorithm borrows wildly as it has $1 million as the notional max and min.
I have modified your example to add a limit on buying power based on 50% account margin. I attached a backtest with the calculation. Feel free to steal the source code. Although I can't guarantee that it doesn't have bugs!
I had to increase the starting cash to $100k just because Apple has such a high price. But even so the results aren't spectacular :)