Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 14:38:13 +0000



Limit order Fills on Replay

View Count: 2459

[2017-03-02 15:55:34]
User794640 - Posts: 33
Good morning.

I'm testing some strategies on CL futures market using the attached orders from the order window and a strategy coded in ACSIL. What I'm finding is limit orders are frequently getting filled at prices not possible/probable in the real market. Limit orders getting a few and sometimes more ticks of price improvements. For example:

I am long CL futures 1 contract, on the attached orders screen I set it up for a bracket order of 8 tick target and 8 tick stop. I often get filled for 10 tick profits. In the real market, my limit order would get taken at the 8 ticks. I've traded manually for years and don't think I've ever had a price improvement on a limit order in a liquid market like crude.

Is there a setting to force a fill at the target limit price instead of allowing price improvement?

edit: I'm using the Accurate back testing system replay method of testing. I have also messed around with the "update chart internal" setting. I've tried 100 plus I've also tried down to 50. I have a fast machine with and i7 6 core CPU and fast SSD drive, 16 GB memory if any of that is helpful.
Date Time Of Last Edit: 2017-03-02 16:03:48
[2017-03-02 15:59:46]
User794640 - Posts: 33
As a followup, I did the same test with the same bracket orders on a much thicker liquidity instrument (ES) and I'm getting the price improvement on limit take profit orders almost every day. I've tried to use different backtesting speeds on replay and that doesn't seem to matter. I've also tried using the tick for tick accurate system replay and it doesn't seem to make any difference either.
[2017-03-02 18:10:23]
User794640 - Posts: 33
I just got done with a longer backtest and I've noticed that the price improvement discussed above stopped occurring starting the week of 01/22/2017. Please see attached screenshot of weekly trading results in particular the largest winner and largest loser columns. This backtest was 4 tick profit and 6 tick loser for CL so max profit should be $40. If you reference the screenshot, every other week had largest winners in excess of $40 (which shouldn't happen with limit order take profits) but the last 6 weeks functioned as one would expect. I thought this may be helpful in your analysis of my issue. Thank you.
imagebacktest.PNG / V - Attached On 2017-03-02 18:10:13 UTC - Size: 159.51 KB - 315 views
[2017-03-02 19:20:20]
Sierra Chart Engineering - Posts: 104368
Refer to these sections here:
http://www.sierrachart.com/index.php?page=doc/TradeSimulation.php#TradeSimulationBidAskPrices
http://www.sierrachart.com/index.php?page=doc/TradeSimulation.php#HowOrdersAreFilled

The first step is to understand what the Bid and Ask prices are at the time of fill.


Is there a setting to force a fill at the target limit price instead of allowing price improvement?
No.

If you are doing back testing across tick by tick data, then what we think the problem is that sometimes there is a lag with the bid and ask updates from the data feed relative to the current trade prices, and therefore they are out of sync.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-03-02 19:21:27
[2017-03-02 20:49:05]
User794640 - Posts: 33
sometimes there is a lag with the bid and ask updates from the data feed

Is there a different data feed that provides better data? I'm on CQG Fix for data/trade service data. When I replay a chart from months ago I was under the understanding that I wasn't using CQG data anymore but I was using Sierra's data. Am I wrong on this one?
[2017-03-02 22:19:03]
Sierra Chart Engineering - Posts: 104368
No. Our own data feed is direct from the CME multicast feed. You will not get anything better. And using CQG is not any worse.

Now that we think about this, what you describe here makes sense:
I'm testing some strategies on CL futures market using the attached orders from the order window and a strategy coded in ACSIL. What I'm finding is limit orders are frequently getting filled at prices not possible/probable in the real market. Limit orders getting a few and sometimes more ticks of price improvements.

It is very common in the CL market when there is a fast move for the bid and ask data to lag behind and therefore you would get the result that you are describing.

The only practical solution is for us to add an option to not use the actual bid and ask prices and to estimate them instead during the back test.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-03-02 22:19:30
[2017-03-02 22:31:28]
User794640 - Posts: 33
It would make backtesting results way more accurate to do what you mentioned. Add an option for a limit order to fill at the limit price exactly (If price trades through it of course). When the bid/ask get separated it makes back tests results extremely misleading compared to live results. For example, I just ran a backtest where I had a 20 tick take profit limit order show that I got a fill at 60 ticks of profit. No way I can rely on that info for live trading. I would love to be able to have a backtest that fills if price trades through the limit order BUT the fill price is always exactly the limit order and also if the stop price trades at all provide a fill at the stop price. I can adjust for slippage on my own or you could add a slippage estimate number if you wanted the user to be able to control estimate average slippage per trade.
Date Time Of Last Edit: 2017-03-02 22:41:13
[2017-03-03 06:29:45]
User794640 - Posts: 33
The only practical solution is for us to add an option to not use the actual bid and ask prices and to estimate them instead during the back test.

Is this something that can be done without much if any new development? I remember seeing in the documentation, bids/offers are already being estimated in the bar based back test. This exact issue is why I've moved away from Ninjatrader because of these price improvements of limit order fills. I feel this is a very critical issue because people shouldn't be taking trading ideas live to the market thinking they have historical data to stand behind but the historical backtesting is flawed because of this bid/ask - price divergence.

I appreciate your time.

Edit: I just went through and did a bar based backtest. The results weren't similar to the replay backtest as I'm trading with range bars BUT the whole price improvement issue on the limit orders completely went away.
Date Time Of Last Edit: 2017-03-03 06:40:21
[2017-03-03 14:11:38]
Sierra Chart Engineering - Posts: 104368
We are working on the new setting now. It is not difficult.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-03-06 16:42:13]
User794640 - Posts: 33
Thanks for getting this pushed out in the pre-release. I had a chance to test it and I'm coming up with the same fills and same price improvement on limit orders regardless if I select the estimate bid/ask on replay or leave it unchecked. Please see attached screenshots.

I tried deleting and re-downloading data as well and it didn't help. Maybe there is another setting that I'm not applying correctly. Thanks in advance.
imagesim bad ask.PNG / V - Attached On 2017-03-06 16:41:38 UTC - Size: 131.39 KB - 316 views
imagenon simulated.PNG / V - Attached On 2017-03-06 16:41:43 UTC - Size: 129.99 KB - 311 views
[2017-03-06 19:22:49]
Sierra Chart Engineering - Posts: 104368
We verified that the Bid and Ask prices are now estimated when that option is enabled.


You can see these estimated values with each order fill.

An example of this is shown in this section here:
http://www.sierrachart.com/index.php?page=doc/TradeSimulation.php#HowOrdersAreFilled

They should be within one tick of the last trade price. If there is a problem we need to actually see the order fill line from the Trade Activity Log.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-03-06 20:14:37]
User794640 - Posts: 33
I looked at the trade activity area and ran a simulation replay with the simulated bid/ask on and off and if appears that on both sets of conditions the bid/ask is a one tick spread.

Please look at the attached trade example from the trade activity when I had sim bid/ask checked (it looks the exact same when sim bid/ask is unchecked as well). An order to open the trade is filled at 36.90 and a limit sell order is entered at 37.00. The eventual fill is 37.03 which is an example of this price improvement that wouldn't occur in the real market. That 37.00 limit would have stood in the orderbook and got taken out prior to price trading at 37.03.

When I did the bar based backtest I previously mentioned in this thread it fixed the limit price improvement issue and I thought it was because of the use of simulated bid/ask but I'm beginning to think that wasn't the case since I'm not noticing improvement in the issue after checking that option.

What about the attached section from your documentation which says during a bar based backtest that sell limit orders will not be filled at a price greater than the limit order even if the bid/ask is showing higher than the limit order (I'm paraphrasing here). Could this logic be applied to the replay back test to ensure that price improvement on limit orders doesn't occur?

edit: Here's what I found in the documentation about stop orders during a bar based replay. I think having this logic choice for stops as well as limit orders in a replay backtest would greatly help accuracy as well:

" During a bar based back test, a resting Stop order will not fill at a price which is more than 1 tick away from the Stop price if the Bid and Ask prices processed are beyond the Stop order price and the Last trade price has triggered the Stop. So the order will be filled at the Stop order price +/- 1 Tick, which can be different than the processed Bid and Ask prices. This happens in order to simulate smooth price movement in the case where when running a bar based back test, not every price tick is necessarily available."
Date Time Of Last Edit: 2017-03-06 20:53:08
imagesim bid bad indvidual trade.PNG / V - Attached On 2017-03-06 20:02:37 UTC - Size: 14.54 KB - 399 views
imagelimit order issue.PNG / V - Attached On 2017-03-06 20:02:46 UTC - Size: 8.66 KB - 291 views
[2017-03-06 21:46:31]
Sierra Chart Engineering - Posts: 104368
and a limit sell order is entered at 37.00. The eventual fill is 37.03 which is an example of this price improvement that wouldn't occur in the real market. That 37.00 limit would have stood in the orderbook and got taken out prior to price trading at 37.03.
The problem is the order price you are setting. You are using an order price below the current price.

You can see that here:
https://www.sierrachart.com/Download.php?Folder=SupportBoard&download=11130

So the solution to this is on your side.

Could this logic be applied to the replay back test to ensure that price improvement on limit orders doesn't occur?
No, we would not do this for replay back testing.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-03-06 23:33:06]
User794640 - Posts: 33
The problem is the order price you are setting. You are using an order price below the current price.
I believe this is an incorrect response, the highlighted row was the closing transaction from the attached orders area. The entry order (one line above highlighted row) generated from my code was to get long via a market order at 36.90 and use the attached orders to put out a stop at 36.80 and a take profit limit order at 37.00. Instead of filling at 37.00 like it should have, it filled at 37.03 which is not possible in the live CL market.

So the solution to this is on your side.

Please clarify how this is on my side, I've simply triggered a market order and using a 10 tick bracket with the trade window attached orders screen

"Could this logic be applied to the replay back test to ensure that price improvement on limit orders doesn't occur?"
No, we would not do this for replay back testing.
Are you okay with your backtesting program filling limit orders blatantly different than how the exchange fills limit orders? A resting sell limit order at 37.00 should NEVER fill at 37.03. Also, this was just one example, I've seen sell limit orders on these simple backtests fill 20 ticks higher. This simply doesn't happen in the real world and it makes these backtests meaningless and quite frankly IMO dangerous for people to rely on these numbers and take their strategy to the live market.
Date Time Of Last Edit: 2017-03-06 23:49:58
[2017-03-07 00:11:47]
Sierra Chart Engineering - Posts: 104368
OK, we were concentrating the individual order and were not paying attention to it being an Attached Order submitted at an earlier time.

Use the Intraday data editor:
Intraday Data Editor

See if there is a jump in the last trade price from below 37 to 37.3 at the time of the order fill.

The reason we are hesitant to make a change, is because we do not want to alter the fill prices of orders different than the actual market data is indicating. However, we do see your point. So we are thinking about this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-03-07 00:12:08
[2017-03-07 01:55:49]
Sierra Chart Engineering - Posts: 104368
We realize now, that the original problem we were intending to solve with the new option was solved already in a different way but was not documented. That is why you did not see any benefit of the new option.

So we will change the purpose of this new setting to limit to fill price of a resting limit order to the limit price itself.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-03-20 05:42:56]
Sierra Chart Engineering - Posts: 104368
This thread is considered resolved.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account