SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Sep 16, 2019 7:37 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri May 30, 2008 11:05 am 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
Hi everyone,

I just want to ask if somebody knows good techniques to reduce the slippage risk, especially in future Trading. I am Trading the FDAX (1Tick = 12.5 EUR), and the more trades you got, the more slippage risk you will have.

I would define slippage not only as the difference between desired price and executed price, but also the difference between backtest fill price and live trading fill price.

Let's take a simple example from my backtest.

I want to go SHORT if the price crosses the last Bollinger Lower Band Value which is 6762.76. Currently, the last traded price is above 7000.

In Backtest, the Order was filled with 6763,50, as you can see in the screenshot below.

The Code to entry is:

Code:
if(trade.Price < bbl.Last)
   {
                              OpenPosition(PositionSide.Short,trade.Price  +0.5);
               
            
   }


As you can see, I try to grab an additional tick from the last trade price.

Let's assume the trade price is 6762.50. So the limit must be 6763. The Order is filled with 6763.50 (see screenshot).

All in all, we have gained 1 Point = 25 EUR difference from the initial trade price which triggered the Short entry.

And now - what about Live Trading? From my experiences, in almost all cases this kind of orders are filled exactly with the limit price (-0.5 pt) or even not at all. This can make a good strategy in backtest a bad one in live trading.

So what can I do to optimize the entry behaviour? (except forgetting the extra 0.5 pt and send the order with the last trade price.)

I thought of something like assuming, that the price I need for triggering the entry, will be coming in the next 2 -3 ticks, and I place my Order right before it hits the desired price. The only Problem is, that the Backtest would not show correct results.

So my conclusion of all of this is that in Live Trading, I should use slightly another entry/exit order management a in the backtest, to get closer to the backtest results. It sounds weird, but I would like to know if someone has similar thoughts about this whole subject.


Attachments:
slippage.JPG
slippage.JPG [ 7.49 KiB | Viewed 7200 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Fri May 30, 2008 5:35 pm 
Offline

Joined: Tue Apr 29, 2008 11:00 pm
Posts: 43
The smaller the timeframe you use, the less slippage you need to worry about, I am collecting and testing with 1 second bars (equities) and at this timeframe if I use 0.0005% slippage it’s been more than enough to give me accurate execution.

A side note, the slippage resets to 0 every time you close the program.

Powers that be: can you possibly make it remember the value? Every now and then I forget to set it when I reopen OQ.


Top
 Profile  
 
PostPosted: Tue Aug 26, 2008 9:33 am 
Offline

Joined: Wed Aug 13, 2008 12:16 pm
Posts: 45
The smaller timeframe might help with equities, but less so with instruments with an artificially wide spread (like FDAX or ES). On an ES trade, each tick is $12.50. If your simulated execution is off by that on position open, and then again on position close, that's a fairly significant difference. Consider a system that generates 100 points while over 100 trades -- the variance could be as much as 1/2. Or you could even design a scalping system that merely placed a buy at the bid, and sell at the ask, and if the software fills your limit if those prices are merely traded at, your system looks brilliant.

It's very important to have an accurate way to deal with this for anything that intends to be anything near a scalping system on an instrument with a spread of size.

One really neat simulation feature I've seen on another product actually handles simulated fills on limit orders by introducing a simulated delay for order placement, then appears to track the number of orders executed at the price level. So, if you enter a bid at 1300, and the current bidsize is 3000, you won't get a fill until 3000 contracts have traded at 1300. Obviously in a real market, some people might cancel orders, but conservative is better in simulation. One possible solution could be to put your limit order 1 tick below (for bids) and 1 tick above (for asks), then you know that if it was hit, your real target price was filled, and just subtract 1 tick from each side of your execution to get an accurate number. But, that's messy.

All that to say, I'd be really interested in whatever comments others might have on flotschie's question as well :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 5:27 pm 
Offline

Joined: Tue May 27, 2008 10:44 pm
Posts: 41
This is why I do all my backtesting using my own code in c#. That way you can build in latency and create bid/offer fills based on the size of level and actual order flow. It's much more accurate.

When using other products often the fills are completely inaccurate. OQ's papertrading is like that. You get filled basically on the first tick where your bid/offer is at. For products with thin levels this isn't such a big deal but on something like the S&P it can severely skew results.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 6:17 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
FYI. You can simulate partial fills in OpenQuant using order book...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 7:38 pm 
Offline

Joined: Wed Aug 13, 2008 12:16 pm
Posts: 45
I am not sure if I understand partial fills simulation correctly. If I capture quote data, will the simulator track, for example, how much volume is executed at the bid, and only execute my limit order placed at the bid after the number of contracts listed at the bid before i placed my order are filled? Or does it operate some other way? I feel like I really need to understand how to get accurate fill simulations before trusting the results I get with a scalping system simulation.


bfq3000: have you integrated your execution code with OQ somehow, or are you talking about a completely separate solution?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 8:01 pm 
Offline

Joined: Tue May 27, 2008 10:44 pm
Posts: 41
I use a separate solution. Basically it reads csv files of historical data and simulates performance using various strategy classes. Once I've come up with something I'm satisfied with I create an OQ project. A bit of editing needs to be done, but since it's already in C# that speeds up the process considerably.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2008 12:22 am 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
@Anton: Is it somehow possible to use the OrderBook functionality in Simulation Mode? If yes, how can I build up orderbook data (although my dataprovider does not provide historical orderbookdata...)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group