View Full Version : Fill outside the bar...
DarrylT
01-17-2007, 11:17 AM
Hi,
While running NTv6.0.0.6 Strategy Analyzer there are sometimes trade fills appearing outside the prices of the bar at that time, see attached graphic for an example.
Thanks.
NinjaTrader_Dierk
01-17-2007, 11:32 AM
Just on one particular order/fill:
- what type of order was that? (market/limit/stop/stop limit)?
- what market direction? (long/short)
- what was the limit and stop price?
- what was the historical fill price?
Thanks
NinjaTrader_Dierk
01-17-2007, 11:38 AM
Forgot:
- what was OHLC of the very bar?
- what was OHLC of the bar before?
Thanks
DarrylT
01-17-2007, 12:39 PM
I've added comments below at **DT**. Were you able to see the graphic?
Thanks.
Dierk Droth wrote:
Just on one particular order/fill:
- what type of order was that? (market/limit/stop/stop limit)?**DT** Limit.
- what market direction? (long/short)**DT** Covering long and entering short at the same time.
- what was the limit and stop price?**DT** Limit entry at 796.10
- what was the historical fill price?**DT** Filled at 796.10
- what was OHLC of the very bar?**DT** 796.2, 796.4, 796.2, 796.2
- what was OHLC of the bar before?**DT** 796.1, 796.2, 796.1, 796.2
Thanks
DarrylT
01-17-2007, 12:49 PM
Hmm. To get the information for the previous reply I changed the Strategy Analyzer to show only 1 day's data so I could add some print statements to the code. And the chart looks different. The bar of the fill is now larger (see attached graphic), and the fill is the low of the bar. A couple of questions:
- How is it possible for the chart to be different? Yes, these are volume bars, but the volume from the start ofa givenday should be the same whether we're chartingthat single day or looking at the day within a chart of several weeks.
- I thought limit orders in backtesting were only filled if there was a trade through the limit price? The bar of the fill, and the bars before and after all have the same low, equal to the limit entry price of 796.1.
Thanks.
NinjaTrader_Ray
01-18-2007, 03:34 AM
Several points -
Filling outside the bar - This is possible with our conservative fill algorithm. Limit orders submitted that would fill at market (sell limit below the market) will fill at your limit price, not better. This is what you experienced. If you do not agree with our approach, you can add a user defined fill algorithm. This is currently not documented however, all you need to do is make a copy of C:\Program Files\NinjaTrader 6\bin\Custom\Type\@DefaultFillType.cs, open it in VS orsome other editor, change class name, display name and the fill logic. Compile any indicator or strategy in the NinjaScript Editor. Next time you backtest, this new fill type will be an option.
Chart - If you have session start and endtime defined (not 12 - 12) then the chart should be identical. If this is not the case, please let us know. If the chart is 12 - 12 this is considered 24 hour and bars can span across a calendar day thus you could have a different chart for 3 days than 2 days.
Ray
ggingembre
03-25-2008, 03:31 PM
Hello,
I am using NT 6.5 beta, and I get the exact same problem - a signal generates a limit buy order with limit price @ current bar close + 5 ticks; and the system gives me fills on the following price bar, but outside of the price bar (above, at a price that did not exist).
How can we change this? Ideally, I would like to get the opening price of the following bar, to be able to analyze market behavior alone, without any consideration for market impact (will conduct this analysis at a later stage).
Thank you,
Guillaume
NinjaTrader_Ray
03-25-2008, 03:52 PM
In reality, if your order was live, it would have filled at that price and not worse as the next bar gaps down. Have you tried the Liberal fill type? I can't remember if this algorithm will ensure that you are filled on the bar.
ggingembre
03-25-2008, 04:33 PM
Thanks for your reply. Yes, I tried the liberal algorithm, and it does fill within the bar. Is it possible to just get the opening price of the bar, to analyze the strategy itself? Would it be possible to modify the code of the existing default algorithms to get this?
Thank you,
Guillaume
NinjaTrader_Ray
03-25-2008, 05:36 PM
It is possible to custom program your own fill type algorithm but we do not provide support on how to do this. If you are an accomplished programmer, you can take a look at the source code for the provided fill types located in the \Custom folder and figure out how to code what you want.