I'm running a backtest with a fixed positionsize for each trade. However, at some point during the backtest the positionsize goes totally wrong and the size gets significantly reduced for no reason. Below is the code, and attached is the trade report list where the sizing goes wrong. What is the problem here? I cannot see any problem in the code at least. The system makes about 12000 trades in a 12 year period if that makes sense.
I'm not sure if that's the problem in this situation but the backtester by default will limit you to trade a maximum of 10% of the daily volume. You can change this in the backtester settings under the portfolio tab:
As you might have noticed, what is totally wrong is an assumption that you can trade more than 10% of bar volume without affecting price. AmIBroker does correct thing in limiting users unlimited appetite for absurd profits not achievable in real life due to simple things like liquidity limit. Turning this protection off is not a “solution” but “totally wrong” decision (like throwing out thermometer when you got a fever so you don’t worry about it any more)
My take is this should be off by default. If people don’t realize they can’t do 1 million contracts on a tick in Ethanol, lol then that’s their problem.
Far worse, IMHO, would be someone looking at a log equity chart and seeing what would appear as a “Technique’s” breakdown and lost consistency, when unbenounced to them, it was just a liquidity limiter.
I imagine all those robust and great techniques that were unknowingly thrown away.