Thinking Stuff's ATM

Automated Trading Machine (ATM) makes it simple to remove fear and greed from your trading. Automated trading is no longer just for the rich or nerdy. Our revolutionary software runs on your computer, using your trading rules, but none of your emotions. There's just one requirement - you know how to use a mouse.  Learn more...

Thinking Stuff's ATE

Automated Trading Execution (ATE) is where we run your trading systems for you on our servers. Your system can be exported from ATM, or written in plain English and we'll make it for you. We'll even backtest and suggest improvements if you want us to. This service essentially automates your automated trading.  Learn more...

Thinking Stuff's Groups

Join a group of like-minded individuals, and help each other to trading success. Once you join a group, you will have access to that group's trading systems, ideas, and feedback. And please contribute your own knowledge as much as possible. Or contact us to start your own group.  Learn more...

PWB#2 - Opening & Closing Trades In The Same Bar

Let's say you have only interval data (open, high, low, close) on which to perform your backtesting (i.e. no tick data).

And let's say your system wants to enter long at the high of the most recently closed bar, and it wants to set it's stop loss at the low.

And let's say the following bar has a higher high than the one used for the entry and stop loss calculations, and a lower low. There are three possibilities here:

Firstly, the price may have first risen above the high of the previous bar, thus triggering the long entry. We're in the trade. And then the price dropped below the low of the previous bar, thus trigging the stop loss. We're out of the trade at a loss.

Secondly, the price may have first dropped below the low of the previous bar, thus triggering nothing because the stop loss doesn't come into effect until we're in the trade. Then the price rose above the high of the previous bar, thus triggering the long entry. We're in the trade.

Thirdly, the price may have first dropped below the low of the previous bar, thus triggering nothing because the stop loss doesn't come into effect until we're in the trade. Then the price rose above the high of the previous bar, thus triggering the long entry. We're in the trade. And then the price dropped below the low of the previous bar, thus trigging the stop loss. We're out of the trade at a loss. While unlikely, in fact the price could have rebounded many times between the high and low of the bar during the time the bar was formed - there's no way to know if tick data is not available.

This third scenario forces us to have a policy of once being stopped out of a trade, we wait for the bar to complete before calculating a new entry point (as opposed to using the old entry price calculation to get back into a trade if the price rises to that level once more). That's my policy, anyway. Backtesting would be impossible without it as we would not be able to predict the results in this situation.

Anyway, the first and second scenarios alone highlight a problem with backtesting using interval data. Two completely seperate outcomes are possible. And so, I think there is no other option but to either (a) track both possibilities and show two sets of results at the end of the test; or (b) always assume the worst case - that the price first went in a direction in order to get us in to the trade, and then went in a direction that took out the stop loss.

Feel free to ask questions if I didn't explain that very well.
 

Scalping techniques

All that means some valid trading systems cannot be backtested. (These are different to Impossible Trading Systems which can be backtested, but can't actually be traded).

For example, scalping techniques are generally always exiting their trades in the same bar that they entered the trade. Unfortunately this means any scalping techniques have to be backtested using tick data, rather than interval data.

But, if you're looking to enter the scalping business, it's probably worth your while to go through the extra steps necessary to backtest using tick data.
 


Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <img> <em> <strong> <u> <strike> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h4> <h5> <table> <thead> <tbody> <th> <tr> <td>
  • Lines and paragraphs break automatically.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Image links with 'rel="lightshow"' in the <a> tag will appear in a Lightbox slideshow when clicked on.

More information about formatting options