Extract price data at specific time

Questions about MultiCharts and user contributed studies.
seneca
Posts: 97
Joined: 02 Apr 2012
Has thanked: 38 times
Been thanked: 22 times

Extract price data at specific time

Postby seneca » 14 Feb 2013

I wonder if there is an option to extract price data at a specific time "between" the bar intervals.

For example, I want to extract the settlement price of LE at CME, which is being determined once a day at 13:00 (Exchange time).
If I use a 15 minutes bar chart, I will have on the Monday session 12:50 close and a 13:05 close, but no 13:00 close.

Currently, I use this code to circumnavigate this issue:

Code: Select all

if time >= settlement_time then begin
if count_c = 0 then begin
count_c = count_c + 1;
settlement_price = close;
end;
end;
if time < settlement_time then count_c = 0;
Although, this is rather a workaround, since it will use the 13:05 close instead of the 13:00 close if being applied on the example given above.

So I wonder if you really have to decrease bar intervals to 1 or 5 minutes in order to work around this issue, or if there is a solution that works with 15 minutes or even higher bar interval.

Any help is highly appreciated.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Extract price data at specific time

Postby TJ » 14 Feb 2013

look up:

CURRENTTIME

seneca
Posts: 97
Joined: 02 Apr 2012
Has thanked: 38 times
Been thanked: 22 times

Re: Extract price data at specific time

Postby seneca » 15 Feb 2013

Hi TJ,

Thanks for your reply. In principle, this should work, but since I generally base my charts on exchange time instead of computer time, I would prefer if there would be something like "CURRENT_EXCHANGE_TIME", but I think there isn't?

Of course you can do the math and convert the time, but since the delta T is not constant (due to daylight saving time, change of time zone etc.), this does not seem to be a fully satisfying approach to me.

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

Re: Extract price data at specific time

Postby Andrew MultiCharts » 15 Feb 2013

Although, this is rather a workaround, since it will use the 13:05 close instead of the 13:00 close if being applied on the example given above.

So I wonder if you really have to decrease bar intervals to 1 or 5 minutes in order to work around this issue, or if there is a solution that works with 15 minutes or even higher bar interval.
IOG + Bar Magnifier with the new Enable access to intra-bar time for calculation in Intra-Bar Order Generation mode check box should help.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Extract price data at specific time

Postby arjfca » 24 Feb 2013

Hi TJ,

Thanks for your reply. In principle, this should work, but since I generally base my charts on exchange time instead of computer time, I would prefer if there would be something like "CURRENT_EXCHANGE_TIME", but I think there isn't?

Of course you can do the math and convert the time, but since the delta T is not constant (due to daylight saving time, change of time zone etc.), this does not seem to be a fully satisfying approach to me.
You could synchronize your PC clock just before opening MC. Then your system clock will be very close to your broker time. That is what I do when broker time and PC time is out of sync.

For sure it would be interesting to have some Powerlanguage function to sinck MC time with broker. I know it is possible to read, at least Interactive Broker time from an API.

Martin


Return to “MultiCharts”