Different Open and CloseD values

Questions about MultiCharts and user contributed studies.
evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 123 times

Different Open and CloseD values

Postby evdl » 05 Dec 2012

I use IB TWS and 1 minute charts and in my strategy I make use of the open price (opend) of the day and the close price of the day (closed).

With symbol DAX index(DTB exchange) but also with other symbols.

I have noticed that sometimes the open and closing price is different from the real "opend" and "closed".
MC is using the first 1 minute trade of the day and the last 1 minute trade of the day.

As I look in Quotemanager, the real open and closing price is there but only in the tick trade section that is collected realtime.

Doesn't MC look in the API TWS for the closing and open of the day instead of using the chart resolution data for this data.

The open and close of the day is used frequently for calculating. I hope the solution is not to use two data series per chart (and also a lot of tickdata) to get accurate strategy calculating when using the opend and closed reserved words.

Or do I need to adjust some settings or code?

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: Different Open and CloseD values

Postby Andrew MultiCharts » 05 Dec 2012

Hello evdl,

MultiCharts works with 3 base resolutions. When you apply a script to the chart, you should take into account what data was used to built that chart. The script uses only the data available on the chart, it doesn't request any other values. The solution might be to use daily-based data on subchart 2 and reference its values from script applied on subchart 1.
Take into account 2 additional factors:
1. Session settings in MC can affect data on chart if it is tick-based or minute-based data. If it daily-based data, sessions in MC do not affect it.
2. Regular Trading Hours check box affects daily-based data for IB data source:

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 123 times

Re: Different Open and CloseD values

Postby evdl » 06 Dec 2012

Hi Andrew,

I did some testing

Symbol is DAX:

The close of 5 december 2012 taken on 5 december 2012 = 7454.55
the close of 5 december 2012 taken on 6 december 2012 = 7444.77

I have an daily chart as data2.

What I noticed is that the values of the close of 5 december just after the exchange closed is 7454.55 (see DAX close 05-12-12 taken on 05-12-12)

The next morning if I check again, the close of 5 december is 7444.77 (see DAX close 05-12-12 taken on 06-12-12).

7444.77 is the close value of the day that is in quotemanager the next day (and is also the close value of the min date on 17.30, the time the exchange closes).

The day values are on the day itself not in quotemanager and can only be seen the day after.

I suspect that the values are not saved on the day itself (as is with tick and minute), but the next day when I startup MC again. Then it will reload the data from IB.

I also checked the historical time and sales in TWS. And realtime you see the values of the end trade (this is the trades that occurs after the exchange closes on 17.30 cet till 17.40 cet)

The next day you can't see the historical time and sales of the end trade anymore in TWS. That may be the problem, because price changes in this time are not saved realtime? (except for the tick data, that is saved in quotemanager realtime) and therefore if MC is collecting day data the next day, TWS is not providing these and price difference is the result.

UPDATE 6 december 14:44 cet:
If you use the scanner and show the day values of the DAX. The column "Prev" is showing the right close of the day before. Where does the scanner get this value from? Because this value is not in the quotemanager.
Attachments
DAX close 05-12-2012 taken on 06-12-2012.png
DAX close 05-12-2012 taken on 06-12-2012
DAX close 05-12-2012 taken on 06-12-2012.png (176.11 KiB) Viewed 713 times
DAX close 05-12-2012 taken on 05-12-2012.png
DAX close 05-12-2012 taken on 05-12-2012
DAX close 05-12-2012 taken on 05-12-2012.png (165.58 KiB) Viewed 713 times

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 123 times

Re: Different Open and CloseD values

Postby evdl » 06 Dec 2012

I found a way to get the close of yesterday.

I now use "prevclose" in my strategy to get the closing of yesterday. Don't know where it gets its value from(it is not in the day data of quotemanager), but it is the right value.

Update:
Only problem is, that this only works for currentday because prevclose can't be referenced historically. So I am still looking for a solution for the issue with the price difference.

SP
Posts: 453
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: Different Open and CloseD values

Postby SP » 06 Dec 2012

The best solution is to use 1440 Min Charts instead of 1 Day.
These users thanked the author SP for the post:
TJ

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 123 times

Re: Different Open and CloseD values

Postby evdl » 06 Dec 2012

Thank you SP for your reaction.

I tried the setting of 1440 minute for a day as data2 and minute data as data1. But it is for both charts minute data and will use the minute data in quotemanager to get the close value. Which is not in quotemanager because this is not collected.

However if I use minute data for the daily chart to get the close value, it will also not use the right value of the close of yesterday. This is because of the time frame.

In the end trade only the tickdata is recorded by MC. The minute data and day data is recorded till the close of normal tradinghours (17:30) The end trade from 17:30 till 17:40 there is no data recorded for the day and minute timeframe.

In the attached files you can see that the latest value recorded (tickdata is on 17:35:30). So in the minute data timeframe this is not recorded because the minute is not finished. So that is normal behaviour I think.

But the daily data when looking on the chart realtime is collecting the right values. Tick and minute date is saved realtime in quotemanager. But daily data is saved after the day is ended at 24:00? And if you close MC before this. Then it will probably not use the realtime data that is on the chart but request this again from IB the next morning when you start MC again. And this is not the close of the day. So it is requesting something else.

Now that I found the prevclose value, I am confused. Because why is that the right value? How is this requested at IB, because it is not in quotemanager (well, only on tickdata) but not on daily or minute data. If the prevclose uses the tickdata or last know value in quotemanager. So would the closed value should do I think (certainly when using daily time frame).
Attachments
Close 5 dec 2012 tick data.png
Close 5 dec 2012 tick data
Close 5 dec 2012 tick data.png (105.71 KiB) Viewed 712 times
Close 5 dec 2012 minute data.png
Close 5 dec 2012 minute data
Close 5 dec 2012 minute data.png (109.65 KiB) Viewed 719 times
Close 5 dec 2012 day data.png
Close 5 dec 2012 day data.png (110.77 KiB) Viewed 715 times

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: Different Open and CloseD values

Postby Andrew MultiCharts » 10 Dec 2012

Evdl, please see how MultiCharts stores or not collected data. This may help you to understand, how you need to use the software.

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 123 times

Re: Different Open and CloseD values

Postby evdl » 10 Dec 2012

Thanks Andrew for the link.

What I understand is that, when you select in MC download historical data. Everything plotted on the chart or marketscanner is not saved to the database (except for tickdate that is plotted).

I have selected "download historical data". I also selected "collect RT w/o plotting) in quotemanager (see attached files).

With above settings, only quotemanager is saving realtime data, I assume. And the charts are for backfilling historical data.

In my earlier posts, I told about the close of day data (daily and minute data) on the charts realtime, and that the daily close was not in quotemanager. But I also collected these data with quotemanager with the "collect RT w/o plotting" setting. So should it be saved then?

The problem I am having is that the closeD value of the daily data, that is collected in quotemanager realtime and also seen on chart is not saved to the database.

I suspect the collected daily data in quotemanager is only saved to the database if you close MC and quotemanager after 24.00 CET (in my case) and after a new day is began. Because then the "bar" is closed. If you close everything say around 23.00 CET, the bar is not finished and you will loose all the realtime data on the chart, because that was not saved anyway because of the settings. And the next day mc needs to backfill the data. IB does not always provide the correct historical closeD value. At least that is what I think, but it can also be that MC is not collecting the right value. Because the "prevclose" data is giving me the right close of day.

Can you confirm that it is necessary to close MC after 24.00 CET to get the data saved of the daily data that is collected in quotemanager?

What still is a questionmark for me, why the "prevclose" value is the right close of day value and where this is stored or requested. Because I can not find it anywhere in MC or quotemanager in the daily or minute values.
Attachments
Quotemanager collecting settings.png
Quotemanager collecting settings
Quotemanager collecting settings.png (84.82 KiB) Viewed 708 times
MC collecting settings.png
MC collecting settings
MC collecting settings.png (95.75 KiB) Viewed 713 times


Return to “MultiCharts”