Backtest on Bid/Ask data?

Questions about MultiCharts and user contributed studies.
maxpi
Posts: 58
Joined: 03 Jun 2007

Backtest on Bid/Ask data?

Postby maxpi » 11 Nov 2009

Will MC backtest and simulate fills on Bid/Ask data?

User avatar
TJ
Posts: 7153
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 988 times
Been thanked: 2041 times

Re: Backtest on Bid/Ask data?

Postby TJ » 11 Nov 2009

Image
Attachments
backtest_bidask.jpg
backtest_bidask
backtest_bidask.jpg (39.29 KiB) Viewed 2128 times

glen demarco
Posts: 35
Joined: 16 Nov 2009
Contact:

Postby glen demarco » 16 Nov 2009

Yes that my undersatnding of that options. This is a very powerful feature that is not offerredd by either esignal or TS and is the most accurate way of backtesting.

wullenweber helmut
Posts: 57
Joined: 21 Dec 2007
Has thanked: 2 times
Been thanked: 9 times

Limit order touched

Postby wullenweber helmut » 16 Nov 2009

Using the classic mode of backtesting, without bid-ask-data, a feature to set different slippage parameters for the entry and the exit would be helpful.

Lets assume, a trader is entering the market on stop at 2900 (with no slippage) and wants to sell with limit 2910. If the price of 2910 is touched, Multicharts counts this trade as a winning one.

The more realistic view is, to count this trade as a winner not before the price reached 2911, to be sure that the order would have been filled.

My idea of coding this:

If buy condition is true then buy next bar at 2900 limit;

If marketposition = 1 sell next bar at 2911 limit;

Using a feature setting the parameter for slippage by entry = 0 and setting the parameter for slippage by exit = 1.

Resulting a trade with 10 ticks profit in the trade report.

User avatar
TJ
Posts: 7153
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 988 times
Been thanked: 2041 times

Postby TJ » 16 Nov 2009

Image
Attachments
Slippage.jpg
Slippage
Slippage.jpg (47.08 KiB) Viewed 1999 times

wullenweber helmut
Posts: 57
Joined: 21 Dec 2007
Has thanked: 2 times
Been thanked: 9 times

Postby wullenweber helmut » 16 Nov 2009

@TJ

Calculating with slippage on both sides does not solve the problem.

Rick Webber
Posts: 47
Joined: 04 Jan 2008
Has thanked: 21 times
Been thanked: 3 times

Postby Rick Webber » 17 Nov 2009

Can someone give a code example say to"BuytoCover next bar at 1068.25 limit"and "Sell next bar at 1068.25 limit" using the Bid/Ask capabilities in this topic.Thks.

User avatar
TJ
Posts: 7153
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 988 times
Been thanked: 2041 times

Postby TJ » 17 Nov 2009

Can someone give a code example say to"BuytoCover next bar at 1068.25 limit"and "Sell next bar at 1068.25 limit" using the Bid/Ask capabilities in this topic.Thks.



There is no change to the code.
(remember: this is the backtest of a code !)

the only difference is the application of data:

in a normal Classic Backtesting, you use one data stream -- the consummated trade price at specific time intervals.

in an Extended Backtesting (bid/ask),
you apply 2 data streams to the chart.
with the first data stream, you assign the ask price to the Quote Field,
and
with the second data stream, you assign the bid price to the Quote Field.


Image
Attachments
bid_ask.jpg
bid ask
bid_ask.jpg (37.91 KiB) Viewed 1995 times
Last edited by TJ on 17 Nov 2009, edited 1 time in total.

User avatar
TJ
Posts: 7153
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 988 times
Been thanked: 2041 times

Postby TJ » 17 Nov 2009

Bear in mind... if you want to do Extended Backtesting using Bid/Ask prices,
you will need to collect the data ahead of time.



Image



Image
Attachments
Fields_to_Collect.jpg
Fields to Collect
Fields_to_Collect.jpg (16.05 KiB) Viewed 2092 times
QM.jpg
QuoteManager
QM.jpg (21.6 KiB) Viewed 2081 times

Rick Webber
Posts: 47
Joined: 04 Jan 2008
Has thanked: 21 times
Been thanked: 3 times

Postby Rick Webber » 17 Nov 2009

Thks TJ. I understand now. Also just found decent explanation in help files. Should have looked there first I guess.

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1502 times
Contact:

Re: Limit order touched

Postby JoshM » 06 Jun 2011

wullenweber helmut wrote:Using the classic mode of backtesting, without bid-ask-data, a feature to set different slippage parameters for the entry and the exit would be helpful.

I'm wondering how someone would estimate the slippage, if any, when using the bid/ask data when backtesting?

In the MultiCharts manual, page 206, I found the following description:
With Precise Back Testing, the user can load the historical bid data series and the historical ask data series into MultiCharts. MultiCharts will use the ask data series to fill buy market orders and buy stop orders. Similarly, MultiCharts will use the bid data series to fill sell market orders and sell stop orders.

I have not a lot of experiencing with translating backtested strategies to real-time trading conditions (i.e. how a backtested strategy will perform in real-time), so I'm wondering what slippage (if any) penalty would be required when using Precise Back Testing. As I read it, the manual suggests that slippage settings are not needed, but I rather be pessimistic in my assumptions so I'm wondering:

Should I use the normal slippage settings or would that give an extra penalty because the bid/ask data is already incorporated in the spread? Perhaps I can use smaller slippage with Precise Back Testing (say, an half to 3/4 of regular?)

Or should I maintain the regular slippage and use the Precise Back Testing more for testing if there's enough liquidity?

Can someone, support or other users, comment on this?

Thanks in advance,

Josh

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: Backtest on Bid/Ask data?

Postby Stan Bokov » 08 Jun 2011

Well, logically 'slippage' means the difference between the price you expect to get filled at and the price you actually get filled at.

If you are doing standard backtesting using Trade prices, and your strategy performs well, you may be expecting to receive similar performance during real-time (innately assuming that fills will happen at prices similar to Trade prices). However, in real-time you get filled at Ask and Bid, which increases the slippage, and thus makes your backtesting look overly optimistic.

Most traders would rather avoid overly optimistic backtesting, and bring it as close to real-time as possible. Using Bid/Ask series for backtesting will give you more realistic fill prices in the past, and probably bring down the performance of your strategy. This brings it more in line with real-time, and reduces your slippage. However, some slippage factors remain (long fill times, internet disconnects, etc).

I would still assume the worst and keep slippage close to normal, whatever that 'normal' is. Just my two cents.

khalaad
Posts: 317
Joined: 07 Jan 2007
Location: Lahore, Pakistan
Has thanked: 63 times
Been thanked: 57 times

Re: Backtest on Bid/Ask data?

Postby khalaad » 09 Jun 2011

I would still assume the worst...

Sensible, Stan.

I am a discretionary, not systemic, trader. But in recent I have done a bit of research on systematic trading and my finding is slippage should be factored in at 3 times the average spread when running standard back-testing using TRADE prices to adequately factor for the spread, latency, the un-known, etc.!

This way there are fewer forward-testing surprises.


Return to “MultiCharts”