How to use different bar scales and effect upon results
Author: kgk1
Creation Date: 1/15/2015 4:08 PM
profile picture

kgk1

#1
Hello,

I am running backtests using rule based strategies with basic buy at close or at market entries and exits using stop losses, trailing stops, and/or profit targets. I am not using moving averages or anything similar as entry/exit conditions in these tests.

When I use a daily time scale and buy at market, some of the trades are entries and exits on the same day, where the entry at the day’s opening price but the exit is an intraday price which is not the day’s high, low or closing price. Based upon that, I assume that intraday price movements are used even when using the daily time scale.

However, my backtest results are never the same when I use intraday time scales with the same rules. I am using the PosSizer Position Options and have set the option to make one entry per day, and the difference doesn’t seem to be multiple entries and exits occurring each day when using intraday time scales versus daily.

My specific questions are:

1. What effect does using different time scales have upon the backtest results, especially if the sell triggers are based upon simple stop losses, trailing stops, and/or profit targets?

2. Let’s assume I narrowed down a set of stop losses, trailing stops, and/or profit targets which produced a favorable result using the DAILY bar scale over some period of time. Assuming I had actually placed those trades during the time period contained in the backtest using entries at market (attempting to buy at the day’s open price) or entries at day’s close and placed sell orders with my brokerage at the same time using my preferred stop losses, trailing stops, and/or profit targets, should the resulting trades have been the same as my backtest over that period? (Assume that commissions, skipped trades, and other technical issues do not occur.)

3. What is the correct way to apply a strategy which was perfected using a daily bar scale? I.e., could I set trade orders and obtain the expected result, or should I wait until the day is over and then make a sell decision for the next day based upon the price activity of the current day? To put it another way, must I backtest using a 1 minute time scale if I want to narrow down a set of optimum sell targets to place sell orders?

4. Assuming I use a daily time scale and set a stop loss and profit target exit and the intraday price range crosses above the profit target and below the stop loss, will Wealthlab execute the trade in the backtest based upon which exit was triggered first, i.e., earlier in the actual 1 minute bar scale of the day’s price range, or is the exit determined at random or by some other method?

Thank you!
profile picture

Eugene

#2
Hi,

2. Daily data can be different, unless it's obtained by compressing the intraday data itself. Different data may result in different trades.

4. On a first triggered basis. It's important that the code does not "peeks" as per the WealthScript Guide > Programming Trading Strategies > Peeking.

Not assuming anything, we need to take a look at the code, the data loading and position sizing settings, and the symbols to explain particular trades.
profile picture

Cone

#3
QUOTE:
When I use a daily time scale and buy at market, some of the trades are entries and exits on the same day, where the entry at the day’s opening price but the exit is an intraday price which is not the day’s high, low or closing price. Based upon that, I assume that intraday price movements are used even when using the daily time scale.
Market orders execute at the opening price, whereas limit and stop orders can execute anywhere in the bar's range. Keep in mind that a strategy that enters at market open will exit immediately if the opening price triggers the limit or stop price.

Re: 1. First, differences between intraday pricing and EOD often can be seen, especially because intraday data do not use the "official close" the settle price, or EOD Auction price on the primary exchange. Besides different closing prices, it's difficult to say what else could change based on the dynamics of a given strategy. For example, an intraday strategy may be able to enter and exit many times in the same day, which could not (or should not) occur with a single daily bar. You'd have to add extra code to the intraday strategy to ensure this would not occur.

3. The only thing I'll tell you is that EOD is notoriously "spikey". Spikes, which may be real, but unrealistic trades, can often be spotted more easily in 1-minute data. If you use a stop or limit strategies, make sure to look at your outlier trades - they're outliers because they're often unrealistic. Once you identify the spikes, it's a good idea to add a manual correction, albeit extremely tedious.

This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).