Intraday bar compression is unexpected
Author: SPITFIRE_RUS
Creation Date: 5/21/2015 7:25 AM
profile picture

SPITFIRE_RUS

#1
Good day!

I'm started my trial today - want to compare this platform versus Amibroker.
I imported from ASCII quotes in 1min base interval, example here:
SPFB.RTS,20150521,100000,102740,102740,102240,102390,3523
SPFB.RTS,20150521,100100,102390,102460,102210,102420,2161
SPFB.RTS,20150521,100200,102420,102500,102330,102370,1170
SPFB.RTS,20150521,100300,102370,102420,102320,102390,645
SPFB.RTS,20150521,100400,102420,102450,102280,102310,1264
SPFB.RTS,20150521,100500,102310,102370,102120,102190,2099
SPFB.RTS,20150521,100600,102180,102300,102160,102250,1394
SPFB.RTS,20150521,100700,102250,102530,102250,102520,1836
SPFB.RTS,20150521,100800,102520,102590,102460,102490,1428
SPFB.RTS,20150521,100900,102510,102580,102480,102540,765

1min base chart drawed as intended.
But when I switch to larger interval, all candles slide for some reason.
For example, I switch to 5min interval and get the following candles:
1st candle date 20150521 10:00:00, OHLC: 102740,102740,102240,102390
Same as 1st candle in 1min base interval!
2nd candle date 20150521 10:05:00, OHLC: 102740,102390,102500,102190
So 1st candle didn't compressed, all candles after compressed as intended with 1min shift.

What's wrong?
And, by the way, is it correct that Wealsh-Lab don't save my ASCII dataset after exit?
profile picture

SPITFIRE_RUS

#2
I'm sorry, but could you please dont's change the name of my topic? The compression not different from AB - it's just doens't right. It must compress, for example for 5min inteval and 1min base, first 5 bars, then second 5 bars, and so on.
profile picture

Eugene

#3
Welcome to the forums Sergey.

QUOTE:
What's wrong?

Actually, nothing seems wrong. Let me quote the Wealth-Lab Wiki FAQ > When compressed into a higher intraday scale, the bars are being built in an unexpected manner

* For example, you'd expect the first four 15-minute bars to be compressed into a single 60 min one. However, Wealth-Lab keeps the first one and start merging at the second bar.

Wealth-Lab always assumes end-of-bar labeling. Consequently, if your first bar is labeled 09:30, then it is assumed that this bar is a result of trading between 09:15 and 09:30, and, unless specified otherwise by the data provider, 09:30 is the market opening time, which marks the hourly divisions. Consequently, the first four bars to be compressed into the first hourly bar must be time stamped as 09:45, 10:00, 10:15, and finally 10:30. You can change that by adjusting the market's opening time by assigning a market group to the symbol with the proper market open time in the Market Manager tool.

So, the 10:00:00 bar (that single minute) forms the single 10:00 am bar, the next five 1-minute bars from 10:01 to 10:05 fall into the 10:05 bar and so forth.

QUOTE:
The compression not different from AB - it's just doens't right. It must compress, for example for 5min inteval and 1min base, first 5 bars, then second 5 bars, and so on.

As you can see from my reply, no, it doesn't. It just follows a logic different than you're used to. Something different from our habits is not always incorrect. ;) Generally, we prefer that a topic's title briefly explains the situation rather than attaches a non-informative label like "incorrect", "bug", "wrong", "doesn't work" and so on.

QUOTE:
And, by the way, is it correct that Wealsh-Lab don't save my ASCII dataset after exit?

No, it's not if you mean that the DataSet is absent on program restart. This is some misconfiguration of your system. Off the top of my head:

1. You're starting Wealth-Lab under a different Windows user account on the same PC. They all will have their own configuration e.g. DataSets, Strategies etc.
2. In some (paranoiac) corporate environments, user's AppData/Local folder is known to be erased after a program exits. Although Wealth-Lab keeps its DataSet files under AppData/Roaming, double check that /Roaming isn't write disabled, erased etc.

More reasons - especially if you run WL inside a virtual machine:

WL resets
profile picture

SPITFIRE_RUS

#4
Good day, Eugene!

Thanks for the answer. As I understand, I need to change market settings for my symbol, so it'll compressed in the manner I need. I tried to create market Russia with 10:00 start time and 23:50 end time but without success. Can I change that behavior somehow or not? In AB, there are similar mechanism with start/end time from which bars started to compress.
I really need that, because my plan for the trial - to translate my TS rules from AB to WL and compare test results - so I need exactly the same bar compression.
profile picture

Eugene

#5
The behavior per se can not be changed (it's always end-of-bar) but the Market Manager trick should serve as a workaround. The idea is to alter the open time so that next compressed interval does not fall on even number. Since the default behavior is to assume that an hour starts at 10:00, nothing changes if you set it this way. Instead, try setting the open time to 9:54. Then include the SPFB.RTS symbol on the list of Symbols and click "Apply Symbol Change". Hope this helps.
profile picture

SPITFIRE_RUS

#6
Thanks, now it works! I don't like the bar's time, but it's not an issue for backtesting anyway :)
profile picture

Cone

#7
For what it's worth, the "start of bar" (SOB) convention is pretty widely used by data providers. However, when you view intraday alerts in a backtest application for, say, 30 minute bars, it gives you the impression that an Alert that actually occurred at 10:30 happened 30 minutes earlier, i.e., at 10:00.

Conversely, the "end of bar" (EOB) convention does not give you that illusion, and it drives home the point that strategies can operate only on a fully complete bar's data - not at the beginning of it!
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).