[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Back testing with entry stops and end of day (EOD) data.



PureBytes Links

Trading Reference Links

 
Many AB users have good histories of EOD data but limited real time data histories for back testing.  This can cause some problems such as overly optimistic results when the trading logic uses entry  and exit stops.
 
We all know, or should know, that if you are using the closing price then for realistic results in a back test (BT),  the trading logic should use the open (or later) of the following day as the entry price.  But, what if you are using stops to enter and exit, donâ??t you use the stop price as the entry or exit price in the back test? 
 
The answer is yes (+- slippage) if you are using real time (RT) data for your BT.   However, if all you have available is EOD data for longer term BTs then you need to be wary of calculating results using stop prices.
 
The problem is the close price.  What is the close?  In RT terms the close is the current tick .  With EOD data the close is the last tick of the entire dayâ?¦big difference there, so you cannot use EOD close in your calculations for stop entries.  Again if you use close,  the trade is an EOD only trade and  has to take place the next day whether you specified a stop level or not.
 
So what about the stop price?  To try to simulate the results properly you need to look for highs to be greater than your long entry stop price and for lows to be less than your short entry price.  Reverse that logic for stop exits.
 
I had a trading system that had the best walk forward results I have ever seen, but the nagging thought was that there was a flaw in the logic somewhere as the results were too good, even though  the code passed the simple look forward test.
 
After watching the system trade for several weeks (its an infrequent trader) I could see the problem.  Running the BT frequently throughout the day with an RT data feed from IB the RT close (current tick) would rise above the long entry stop level and I would be long at the ~stop price.  However, a couple hours later the RT close would be below the long entry stop price and the trade would disappear and â??it never happenedâ??.
 
This trade turns out to be a loser when evaluated in RT, but, it does not show up in the BT evaluation with EOD data because of the use of  close.
In this case using high for the BT logic will trigger the trade and it will show up in the BT results as a loser.  You will have the entry at the stop price and the exit will have to be treated in a similar fashion for more realistic results.
 
Bottom line: if you use stops and you only have EOD data available for extended back tests you need to use high and low  rather than close in your trading logic.
 
Cheers
Sid
 
 
 
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___