Back-testing

Paul,

That's not how TS2000i works for me. In real-time, the stop/limit entries and exits occur as they happen and not at the close of bar. Likewise, a back-tested strategy using tick or 1-minute data will give results similar to those seen in real-time. However, the strategy report will NOT give the correct entry and exit times - these will be given as the bar close time.

I wonder why we see different behaviour?

Paul
 
Tradestation 2000i help files - Calculating tick-by-tick order of Historical Data

Time-based bars include the open, high, low, and close for the specified time period. When you work with historical data, TradeStation doesn't know the chronological order of the transactions that make up the bar. The only transactions for which the chronology is known are the open, which occurred first, and the close, which occurred last. With time-based bars based on historical data there is no way to know whether the market opened and then went down, or the market opened and then went up.

However, because the order of ticks can be important, Omega Research extensively studied the movement of various markets to discover a way to determine the most likely chronological order of the high and low ticks. After research, two general rules were established about price movement and the chronological order in which ticks occur.
Assumption 1: The order in which prices on a bar are reached relates to the proximity of the open to the low and to the high

When the open is closer to the low than to the high, TradeStation assumes that the low was reached first. Likewise, if the open is closer to the high, TradeStation assumes that the high was reached first. For example, say you have a buy order at 100. You protect yourself against losses at 97 points or lower, and want to exit the position at 101 or higher. The open is 99 points. The high of the day is 103 and the low is 92, so the open is closer to the high. In this case, your buy order is filled at 100 and your strategy will generate your profit-taking exit order at 101, thus recording a profit of 1 point.

However, it's possible that in reality the price climbed to 100, at which point your entry order was filled, and then it dipped, hitting 99, before climbing back up to 101. In this case, you would actually have taken a loss of 1 point instead of a profit of 1 point. So, looking at historical data, and based on the market assumption described earlier, TradeStation would record this trade as a winner, when it would in fact have been a loser. The opposite could happen also, where a trade could be recorded as a loser when it was actually a winner.

To more closely simulate market activity in these cases, TradeStation developed what is known as Bouncing Ticks™. When enabled, TradeStation automatically sends the data down by a percentage (the TradeStation default is 10%) immediately after a buy or sell order, and then comes back up to the next item on the bar (high, low, or close). This action more closely resembles what happens using real-time data.
Using this 10% setting on the example above, the buy would have happened at 100, and would have dropped immediately by 10% to 99 (to more closely resemble real-time results), your exit would be recorded at 99, and the bar would more correctly reflect the losing trade that would have happened if you had been using real-time data.

Assumption 2: Symbols Trade at Every Price Along the Bar

The second assumption is that a symbol trades at every price along the bar. That may not always be an accurate assumption. If, using the example above again, you had a buy order at 100, and the symbol actually traded at 99 and then jumped to 101, the strategy would record your buy at 100, even though you actually were filled at 101. If your exit was at 110 then, the strategy would record a profit of 10 points, even though your true profit would only be 9 points. This assumption might cause a strategy to appear more or less profitable than it actually was.

TradeStation allows you to avoid both of these assumptions by back-testing to the tick level.

The order of the transactions on the bar becomes very important when you apply a trading strategy to time-based bars based on historical data. For example, if you had no market position and the entry and exit criteria of the trading strategy were both triggered on the same bar, knowing which signal was triggered first would be important.

If the exit criteria of the strategy were triggered first, TradeStation would ignore the exit signal (because there was no market position to exit) and, when the entry signal was triggered on the same bar, TradeStation would issue the entry order, showing that a new position was opened.

The open price of a bar is always number 1. The close price of the bar is always number 4. The numbers 3 and 4 are used to designate the most likely chronological order of the high and low ticks.

Rarely does the market strictly follow the 1, 2, 3, 4, order. Instead, the market bounces up and down. For example, even on a day when the market climbs in a relatively steady manner, there are brief dips followed by still higher highs.

When you apply a trading strategy to a chart based on historical data, a special TradeStation innovation called Bouncing Ticks™ simulates the irregular up and down way the market really moves, even during an up-trend or a down-trend.

The Bouncing Ticks function works as follows: When market conditions trigger the entry signal of your trading strategy (either long or short), TradeStation bounces back by a certain percentage that you specify. If, within that percentage, there is a price that would trigger the exit criteria of your strategy, TradeStation exits the position on the same bar on which you entered the position.

Here is the major reason that TradeStation simulates market activity in this way: During actual market activity, chances are extremely high that once the entry signal of your trading strategy is triggered the market would turn against you by a certain percentage. When testing a trading strategy on historical data, you need to take this normal bouncing market activity into account, particularly when you design your strategy's exit criteria. For example, in real-time market conditions, when the market turns against you, you have no way of knowing if the market will rebound in your direction. Your strategy should be constructed in such a way that it exits your position before you sustain losses that you cannot afford.

When testing a trading strategy on a time-based chart based on historical data, it can signal a flaw in your trading strategy if the strategy repeatedly enters and exits on the same bar. In such a case, we recommend that you re-examine the rules of your strategy and redesign the entry and exit criteria so that the exit criteria of the strategy liquidates your open position only when the market takes a significant turn against you.

For instructions on enabling the Bouncing Ticks option, see Setting the Bouncing Ticks Option.

{ ** © 1987, 1999 Omega Research, Inc. ** }

jtrader.
 
Last edited:
Tradestation 2000i help files - Setting the Bouncing Ticks Option

The default of 10 percent is based on extensive research into how the markets move during the trading day. We recommend that you not change the default value unless you are testing the strategy in what might be considered atypical market conditions. This is a global setting; it applies to any and all strategies. To change the percentage:

1 Use the View – Chart Options menu sequence.

2 Click the Strategy tab.

3 Enter a new value in the Percent increment for Bouncing Ticks box. You can enter a value from 0 to 100.

4 Click OK.

{ ** © 1987, 1999 Omega Research, Inc. ** }

jtrader.
 
Time interval bars - tick-by-tick simulation

Thanks chaps

this is all starting to make a lot more sense now.

The only small issue I have with the omega explanation above is where it says -
Using this 10% setting on the example above, the buy would have happened at 100, and would have dropped immediately by 10% to 99 (to more closely resemble real-time results), your exit would be recorded at 99, and the bar would more correctly reflect the losing trade that would have happened if you had been using real-time data.

Surely a 10% decrease would have gone from 100 to 90?

.........Is this an American way of calculating?

Many thanks

jtrader.
 
Paul,

I havent tried tick trading in realtime, actually thinking about it the differences you describe could be down to how I have written the Easylanguage study and this was a few years ago.


Paul
 
Slippage settings

Hi

with tradestation (2000i) I'm just wondering what are the best slippage settings.

If I am back-testing retail forex EURUSD - with a 3 pip spread - should I simply set the slippage based on 3 pips?

Similarly if back-testing EuroFX futures, which can have a variable spread - depending on market conditions - but is usually 1 pip during the major trading hours - what would you set the slippage based on?

What are the options?

Many thanks

jtrader.
 
jtrader,

Set the "slippage" amount to cover the typical spread, but it is wise to add an extra pip or two to cover for worst-case situations. Specify the amounts as currency amounts appropriately (eg 2-pip spread = $25 slippage for the Globex EUR-USD FX futures contract) TS2000i has a separate "commission" box which allows you to enter the commission charges if you are using a DA broker. Make sure you fill this in if you pay commission. A good-looking strategy can often turn out to be anything but if you don't fill in these two boxes :(

Paul
 
TS8.1 back-testing

Hi guys

With spot/cash EUR/USD specifically in mind, I want my back-test results to be as realistic as possible. Therefore when back-testing my strategies, I do not want to include trades affected by major news releases, as I would not trade during major news releases. Therefore I would not want to include trade entries inside my back-tests results, that had been triggered 15-minutes either side of major news releases (eg.0830 EST).

How would I do this?

This would cancel the effects of including backtest results triggered from 0815-0845 EST. This is not ideal, because major news releases are not daily, and such a blanket approach would exclude this time period from every day. However, at least it would cancel out the big movers that I would not be active in the market during. Is there any way that I could be more specific as to wat days/dates would be excluded during such time periods, so as not to exclude days when there was no major news releases at these times?

Would I need to code the times of day that I do not want trade signals to be included in my back-test results in easy language? or, would there be a simpler way/function within TS8.1 that would enable me to deselect certain periods of the trading day?

How could I incorporate such considerations, in order to obtain more realistic and personalised to my trading style/tactics back-test results?

Many thanks

JT.
 
Last edited:
This is cobbled together from something I tried a while ago - I think it's the sort of thing you want. As it is, it says if it's the first Friday of the month & the time is between 0815 and 0845 then dont trade. You can adjust it as required:

Variable: Trade_Flag(true);

If dayofweek(date) = 5 and DayOfMonth(date)<=7 and time > 0815 and time < 0845 then Trade_flag = false;


{Entries}
If Trade_Flag then begin
If insert entry criteria here then buy next bar at open;
end;

Hope it helps
Simon

jtrader said:
Hi guys

With spot/cash EUR/USD specifically in mind, I want my back-test results to be as realistic as possible. Therefore when back-testing my strategies, I do not want to include trades affected by major news releases, as I would not trade during major news releases. Therefore I would not want to include trade entries inside my back-tests results, that had been triggered 15-minutes either side of major news releases (eg.0830 EST).

How would I do this?

This would cancel the effects of including backtest results triggered from 0815-0845 EST. This is not ideal, because major news releases are not daily, and such a blanket approach would exclude this time period from every day. However, at least it would cancel out the big movers that I would not be active in the market during. Is there any way that I could be more specific as to wat days/dates would be excluded during such time periods, so as not to exclude days when there was no major news releases at these times?

Would I need to code the times of day that I do not want trade signals to be included in my back-test results in easy language? or, would there be a simpler way/function within TS8.1 that would enable me to deselect certain periods of the trading day?

How could I incorporate such considerations, in order to obtain more realistic and personalised to my trading style/tactics back-test results?

Many thanks

James.
 
Thanks TurtleTrader

it's good to see that such considerations can easily be coded in EL.

Cheers

jtrader.
 
Top