Liquidity limit, was: partial fills on futures contracts within backtest

In my back-tests I am not getting complete fills for the total futures contracts I should be trading.

If I have a margin requirement of $5000, and $100,000 in the account, I should be trading 20 contracts for every trade unless the equity falls below 100,000.

I am getting extreme partial fills in the number of shares column (contracts, as I am in futures mode)

PositionSize = -100; // use 100% of equity
MarginDeposit = 5000; // this you can set also in the Symbol-Information page
RoundLotSize = 1; // this you can set also in the Settings page

image

Your assumptions are invalid. Your 100% of current equity position size allows to open position of any size as long as there is cash on account. And current equity changes on bar by bar basis when trade is open. If your equity grows and formula generates extra signals, it may enter subsequent positions that are less or more than 20 contracts using gains from previous trades.

If you wanted to use just 20 contracts you should use

SetPositionSize( 20, spsShares );

If "Allow position shrinking" option is turned on, the above statement still provides room for opening smaller trades. If you don't want shrinking, turn that option off.

First and foremost you should follow advice given here How do I debug my formula? and use Detailed Log as it provides a lot more information than condensed trade list.

Also see How to ask a good question as your post does not allow forum members to reproduce anything

Thank you for the detailed response. The detailed log helped me to answer the question. The trade vol limits were set as a 10% of the trade bar volume.