Fill Types in the NinjaTrader Platform
There are two basic fill types in the NinjaTrader platform. There is the Default Fill and the Liberal Fill. We offer a third fill type for our NinjaTrader Trading Systems called the LiberalWithOpen fill type. This NinjaScript is offered below to use with our trading systems or with your trading systems. We will explain why.
The Default Fill Type is the conservative fill type and will not report a fill unless the price trades through the limit order. The Liberal Fill Type is more liberal and will report a fill if the price touches the limit order, even if it does not trade through the limit. In real trading you may or may not get filled. In back testing there is no way to know for sure if there would have been an actual fill during a simulated backtest and the price only touches the limit order and never trades through.
We have recently been adding code to our stock index strategies, (version 5 of some of the strategies), that allow you to cancel and replace your limit orders after a specified number of seconds. The reason that we do this is so that if we test a strategy with the LiberalWithOpen fill type, we want to make sure we get an actual fill. We do not want to see the price touch the limit order and then rally 10 points without us. We are willing to accept the slippage for these fills if we have a strategy that has a large enough average trade profit to handle the additional slippage.
The settings for our version 5 strategy is shown below.
We set the inputs to True and use between 0 and 15 seconds to ensure we get a fill and the market doesn’t “run away” without us. We set this up to match what we can already do in Tradestation and MultiCharts with some of the automation settings shown below except we used C# in NinjaScript to customize this to do the same thing for both the entry and exit limit orders. This does not apply to market and stop orders.
We typically want strategies to have at least $50 average trade profit before we use these settings.
We added this functionality based on the demand for testing a strategy like Cobra CT Vb E-mini S&P with our LiberalWithOpen filly type. The reason we use the LiberalWithOpen fill type is because the basic fill types, Default Fill Type and Liberal Fill Type do not accurately test some of our strategies. This may also be the case for your strategies and why we offer this Fill Type below.
Cobra CT Vb E-mini S&P, once multiple entry conditions are met, will place a limit order at the lowest low of the last 12 bars but will not include the low of the current bar. We can see below the screen shots of a trade on March 15, 2013 how each fill type was handled by the strategy.
We can see from the images above that the Default Fill Type was filled outside of the price range of the bar and 3 points or $150 slippage away from our anticipated entry point. The Liberal Fill Type did a little big better but was still a full point away and at the high of the bar. The was plenty of opportunity to get filled at our price of 1552.50 since the low of the bar was 1552.00. Even if we had to cancel and replace the limit order to market within 3 seconds, we usually get 1/4-1/2 point of slippage or $12.50-$25.00 per contract. This is better than a full 1 point for the Liberal Fill or the 3 points for Default Fill. The LiberalWithOpen Fill Type gave us the correct fill for the strategy back test.
This Fill Type can be downloaded and used in your NinjaTrader Platform for similar strategies that have problems accurately portraying the correct fills for certain entries.
When you click on the link above select download in the upper right corner of your browser and Save to your computer.
Be sure to place the LiberalWithOpen file in the following directory:
Once you place it in this directory, open up any of your NinjaTrader strategies and then compile (this is not to compile any of your current strategies – it allows NinjaTrader to “find” the new fill type. Next, restart NinjaTrader. Once it is there you will see it in your Fill Type menu selection for your strategies as shown below for Cobra CT Vb E-mini S&P.
The historical fill processing for the Fill Types only affects the backtesting results while the Cancel and Replace input settings only affect automation.