Backtesting - how are "bid" and "ask" simulated?

 

I've been all through the archives and all I can find is more people asking this question with no answers. The question varies and is usually related to "non-reproducible backtesting results".

It is just become obvious to me that "bid" and "ask" are not stored in the data. Since data is frequently sourced from one supplier and actual trading sourced from another, historical "bid" and "ask" would probably be of no value anyway. In fact, tick data isn't even downloaded when one does a historical download.

So, I will attempt to get to the bottom of this. I have downloaded about 100 EA's that show outstanding backtesting results in their documentation. Doing my best to create the same environment (correct pair, correct timeframe, etc.), almost every EA that I try generates a loss. This leaves me extremely frustrated.

Since only open, high, low and close prices are stored (for one-minute intervals), what in the world is MT4 using to determine the "bid" and "ask" when an EA buys at the "ask" or sells at the "bid". I can only guess. Does anyone know? Is there a way to control the spread used in backtesting?

Unless there's something I'm missing (quite possible), I think that backtesting is a total waste of time.

I'm hoping that someone is able to convince me otherwise, as I had high hopes of developing reliable, backtested EA's in MT4.

A typical EA will make a trading decision to buy or sell after each bar closes. Is a "work around" to buy or sell at the next bar's open plus or minus one half of the average spread we experience in real-time trading?

If we have a breakout system that trades based on (say) price going above some point in the current bar (X), should we write the EA to buy at X plus one-half the average spread?

Most of the EA's that I have examined buy at the "ask" price, which doesn't really exist in historical data.

I hope that I haven't rambled too much. This is a complex issue.

Happy New Year to one and all and I look forward to some replies.

Chuck Rademacher
Auckland, New Zealand

 
ChuckNZ:

I've been all through the archives and all I can find is more people asking this question with no answers. The question varies and is usually related to "non-reproducible backtesting results".

It is just become obvious to me that "bid" and "ask" are not stored in the data. Since data is frequently sourced from one supplier and actual trading sourced from another, historical "bid" and "ask" would probably be of no value anyway. In fact, tick data isn't even downloaded when one does a historical download.

So, I will attempt to get to the bottom of this. I have downloaded about 100 EA's that show outstanding backtesting results in their documentation. Doing my best to create the same environment (correct pair, correct timeframe, etc.), almost every EA that I try generates a loss. This leaves me extremely frustrated.

Since only open, high, low and close prices are stored (for one-minute intervals), what in the world is MT4 using to determine the "bid" and "ask" when an EA buys at the "ask" or sells at the "bid". I can only guess. Does anyone know? Is there a way to control the spread used in backtesting?

The spread used is that which your Broker was offering at the time the test started. It is possible to include a spread in the data if you use tick data . . take a look at this site: http://eareview.net/tick-data
 
ChuckNZ:

So, I will attempt to get to the bottom of this. I have downloaded about 100 EA's that show outstanding backtesting results in their documentation. Doing my best to create the same environment (correct pair, correct timeframe, etc.), almost every EA that I try generates a loss. This leaves me extremely frustrated.

Welcome to the REAL world. If one could just plug in an EA found on the web and make boat loads of money there wouldn't be so many depleted accounts.

There are many accounts on this forum of ways of forcing the strategy tester to use whatever spread you like for the testing, but that will only be one fixed spread for the whole test. When I was News trading I was logging the trade to tune my EA for better future performance. The spread is of course continually variable (with my broker at least) and a 3 pip spread has been known to stretch out to more than 20 on big news releases such as the non-farm payroll. Any data you do get will not be relevant to another broker. In fact I was getting different results with the same broker but a different account type such that one account would be a winner and the other a loser for exactly the same trade and the same EA. And just because the terminal receives a quote doesn't mean you can get that price. There is such a thing as slippage which can never be modeled.

So News Trading is the worst possible system to back-test. Trading Daily or weekly trades should be very reliable as spread and slippage are not a problem. In between the back tests get less reliable on the shorter time-frames and when trading through news events or big spikes.

For interest, below are the price ticks for EURJPY (5 Nov 2010). The spread glitch took me in on the straddle trade but I got killed as the actual price went the wrong way :-(


(To avoid disappointment, please do not ask as I will not be supplying the limited historic data that I have for News Trades)

 
RaptorUK:
The spread used is that which your Broker was offering at the time the test started. It is possible to include a spread in the data if you use tick data . . take a look at this site: http://eareview.net/tick-data

Hi Raptor...

It looks like the spread is being pulled from the Market Watch data...?

I have an expired MT4 account that I use for my basic EA testing...no connection or log on...so there is no active spread from the broker...

And the EA appears to be testing fine using the spread that the Market Watch data shows in my expired account.

Is this correct?

BTW...Happy New Year and thanks for all your support and ideas to help others here. May your kindness come back to you 10 fold this year...

Take care,

Robert

* Also Best Wishes to WHRoeder, Uzben, and all the other MT4 helpers/teachers here. I've learned a lot from all of you. Thanks!

 
cosmicbeing:

Hi Raptor...

It looks like the spread is being pulled from the Market Watch data...?

I have an expired MT4 account that I use for my basic EA testing...no connection or log on...so there is no active spread from the broker...

And the EA appears to be testing fine using the spread that the Market Watch data shows in my expired account.

Is this correct?

Yep, as far as I know . . that is correct.

Happy New Year to you too, hope you have a good 2012 :-)

Reason: