SetScaleDaily() does not work as I expect
Author: aykuts
Creation Date: 3/27/2015 8:52 AM
profile picture

aykuts

#1
I am trying to use SetScaleDaily() function on hourly data from database(updated automatically) and it starts from 2 hours before the market close. My problem is when i setscale to daily and plot the daily bar data i see that there is a shift in the daily data. It does not take the morning data as first intraday bar.

CODE:
Please log in to see this code.



profile picture

Cone

#2
Actually, it is working properly. You can't know the High, Low, or Close of a Daily bar until the close of the last bar of the day, and that is where the Daily bar is synchronized in the intraday chart.
profile picture

aykuts

#3
Let me clarify myself a little bit more.

* For some reason, my hourly data starts from 1/1/2010 10:00AM (note that, the hourly bars of a typical trading day starts at 09:00 AM. i.e. my dataseries somehow starts from the "second hourly bar" of the day,
* And, there are 8 hourly bars in Turkish Equity markets i.e. 9:00, 10:00, 11:00, 12:00, recess to the markets, 14:00, 15:00, 16:00, 17:00 = 8 hourly bars for a standard trading day.

* Under this condition, I use the SetScaleDaily() and expect this function to act as follows:
- use the first "7" hourly bars to create the daily bar of the "first" date,
- use the next "8" hourly bars to create the daily bar of the second date,
- etc.

* However, this function doesnt behave as expected, and cannot collide the hourly data info accurately in the form of a daily bar (probably when the first bar of the hourly data is among the mid bars of the day)

* Please have a look at the following snippet:
- the upper pane shows the daily bars (generated with this function)
- lower part is the original data (i.e. the hourly bar data)
- as you might observe, set scale somehow used the first "13 bars"!!! (why?) to generate the daily bar (using the hourly bars)
- that is not the intended behaviour

My suggestion might be that, does wealthlab assume somehow that 16:00 bar is the last bar of the day?

**

Or, forget my suggestion, and I appreciate if you can comment on this problem and the remedy.

Kind regards,


profile picture

Cone

#4
Hi again.
Again, what you're seeing is a result of series synchronization and the requirement to have the same number of bars in the base series for plotting purposes.

The 13 (actually I count 15) daily bars synchronize with the first 8 intraday bars. In an ideal world the first 7 of those daily bars would not be displayed because they contain future information - the low of the 8th bar. However, Wealth-Lab needs to fill the Bars with something to plot the series, so the Bars are back-filled with the first known value.

You simply must ignore the daily information before the end of the first day, which is easy to do by starting the script on the first bar of the second day. Intraday Support Functions in the Community.Components add-in can help here.

Next, that same daily bar is repeated until the last bar of the next day, at which time a new daily bar can be declared. And so on.

Note that for intraday/intraday multi-timeframe synchronization, Wealth-Lab assumes an end-of-bar timestamp. Consequently, the first hourly bar for a market that opens at 9:00am must be timestamped 10:00. Intraday data providers integrated with Wealth-Lab must (should) adopt this format so that the SetScaleCompressed() function works correctly.

Feel free to ask again if this still doesn't make sense. And for more information, see theWealthScript Programming Guide:
DataSeries > Accessing Secondary Symbols > Secondary Series Synchronization
Multi-Time Frame Analysis > Intraday/Daily
profile picture

Eugene

#5
QUOTE:
My suggestion might be that, does wealthlab assume somehow that 16:00 bar is the last bar of the day?

By default, 16:00 is the last bar of the day in the U.S. market. If your data provider supports the Market Manager (which applies to the Database provider, for example), this can be redefined as suggested in the article link.
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).