Join the 80,000 other DTN customers who enjoy the fastest, most reliable data available. There is no better value than DTN!

(Move your cursor to this area to pause scrolling)




"The people at Nirvana have very nice things to say about your company and I can see why! Price and service is a potent combination." - Comment from Ed
"I cannot believe what a difference it makes trading with ProphetX!" - Comment from Bruce in Los Angeles
"IQ feed is brilliant. The support is mind-bending. What service!" - Comment from Public Forum Post
"Thanks for following up with me. You guys do a great job in tech support." - Comment from Phelps
"I am very happy I changed. I love the product, but more so I am thrilled with Tech Support. You are knowledgeable, polite, pleasant and professional." - Comment from Pat
"Thank God for your Data Feed as the only Zippers I see are on my pants (LOL), and no more 200 pip spikes to mess up charts." - Comment from Spiro via Email
"I've been using Neoticker RT with IQFeed for two months, and I'm very happy with both of the products (I've had IQFeed for two years with very few complaints). The service from both companies is exceptional." - Comment from Public Forum
"My broker in Davenport suggested I give you a try as he uses your service and says its the best." - Comment from Bill via RT Chat
"Version 4.0.0.2 has been working well for me and I appreciate that it is now a much tighter client to work with. I feel I can go to press with my own application and rely on a stable platform" - Comment from David in IA.
"Its working FABULOUSLY for me!! Holy cow...there has been so much I've been missing lately, and with this feed and Linnsoft software...I'm in the game now." - Comment from Chris R.
Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »NEW IQFEED FORUMS »Data Questions »Framing update messages by 5 min candles
Author Topic: Framing update messages by 5 min candles (8 messages, Page 1 of 1)

askarali
-Interested User-
Posts: 5
Joined: Aug 23, 2021


Posted: Aug 23, 2021 05:45 PM          Msg. 1 of 8
Hello!

I have a question about update messages.
To form 5 min candles from update messages, what time stamp should be used?
Most recent time or time stamp in T messages?

Thanks.

stargrazer
-DTN Guru-
Posts: 302
Joined: Jun 13, 2005

Right Here & Now


Posted: Aug 23, 2021 06:26 PM          Msg. 2 of 8
Neither?

You need to identify when your candle ends. All trades prior to and including that time are included in the candle. When the next update comes in greater than the end time, emit the candle (with the pre-calculated timestamp) and start the next. Note that sometimes a candle is not emitted if there were no trades within that timeframe.

askarali
-Interested User-
Posts: 5
Joined: Aug 23, 2021


Posted: Aug 23, 2021 07:06 PM          Msg. 3 of 8
Thank you for your reply.

What I would like to do is to create candles synced with other software, e.g. Lightspeed Trader, Webull, Tradingview, etc.
To create the timeframes, would it be good to use local time in EST time-zone?
And I will use the "Most Recent Trade Time" field to include the updates to a timeframe.
Correct?

askarali
-Interested User-
Posts: 5
Joined: Aug 23, 2021


Posted: Aug 23, 2021 11:17 PM          Msg. 4 of 8
I think it doesn't make sense what computer time (EST, EDT, UTC, etc) to use.
I just need to create time-frames first and include the updates in them.
But I will use the timestamp of the update messages for this.
Correct?

askarali
-Interested User-
Posts: 5
Joined: Aug 23, 2021


Posted: Aug 24, 2021 07:57 PM          Msg. 5 of 8
Do the questions not have any sense?

stargrazer
-DTN Guru-
Posts: 302
Joined: Jun 13, 2005

Right Here & Now


Posted: Aug 24, 2021 09:23 PM          Msg. 6 of 8
You can do pretty much anything you want.

You probably want to study market data to see how others select bar start/intervals.

Here is one example of bar building:

https://github.com/rburkholder/trade-frame/blob/master/lib/TFTimeSeries/BarFactory.h
https://github.com/rburkholder/trade-frame/blob/master/lib/TFTimeSeries/BarFactory.cpp

askarali
-Interested User-
Posts: 5
Joined: Aug 23, 2021


Posted: Aug 24, 2021 10:52 PM          Msg. 7 of 8
OK. I am using similar logic.
But there are fields “Last” and “Most Recent Trade” for price.
Which one can be used as a close price?
Note: for a new candle, this will be an open price.

DTN_Gary_Stephen
-DTN Guru-
Posts: 394
Joined: Jul 3, 2019


Posted: Aug 25, 2021 03:14 PM          Msg. 8 of 8
Hello Askrali, I have answers for your questions:

Quote: what time stamp should be used?
Most recent time or time stamp in T messages?


The "T" messages are provided by the IQFeed server. The timestamps messages within each tick are provided by the change, and they reflect the time the tick actually happened. For example:

T,20210825 10:49:43
Q,MSFT,301.7400,10,10:49:42.839858,19,5676548,301.7400,300,301.7600,200,304.3000,304.5900,301.1200,302.6200,ba,87,
Q,MSFT,301.7400,10,10:49:42.839858,19,5676548,301.7400,300,301.7600,100,304.3000,304.5900,301.1200,302.6200,ba,87,

These ticks occurred at 10:49:42.839858, but were not sent out as API messages until after the local server time was 10:49:43. Ticks take some time to travel through the internet, and the synchronization may not be exact.

You probably want to use the timestamps in the tick messages, because these reflect the actual time the tick occurred.

Quote: To form 5 min candles from update message


By the way, yhe IQFeed API has a command that will build 5-minute intervals for you. You can connect to port 9400 and send a command like:

BW,TSLA,300,20210825 090000

300 is the number of seconds in the bar, so 5 minutes. This will give you historical bars as far back as you specify, and will built live ones for you. The response will be like:

BH,TSLA,2021-08-25 09:05:00,706.9800,707.2000,706.9800,707.2000,75526,1792,0,
BH,TSLA,2021-08-25 09:10:00,707.0100,707.5000,707.0100,707.0500,78801,1480,0,
BH,TSLA,2021-08-25 09:15:00,707.1500,707.5100,707.1500,707.2500,83120,2551,0,
...etc...
BC,TSLA,2021-08-25 11:25:00,709.8100,710.3944,709.2500,709.9600,5425296,41704,,
BC,TSLA,2021-08-25 11:30:00,709.9900,710.7500,709.7500,710.5000,5487078,38044,,

"BH" means the message was built from historical data, while "BC" means the message was built from live data. "BU" means a past bar has been updated.

Quote: To create the timeframes, would it be good to use local time in EST time-zone?


All IQFeed timestamps for all exchanges use the US Eastern time zone. This includes exchanges that are not based in that time zone.

Quote: But there are fields “Last” and “Most Recent Trade” for price.
Which one can be used as a close price?


The difference between the "Last" and "Most Recent Trade" fields is this: "Last" includes only "last-eligible" trades. This means trades for more than 100 units. Such trades are allowed to set a high, low, open, or close.

"Most Recent" includes non-eligible trades. They may be for less than 100 units. Such trades cannot set an official high, low, open, or close. If the current High is $8.00 and I buy 99 units for $8.01, the High does not change to $8.01.

You can whichever of the two you want, just understand the difference. If your close price you calculate must match the offical close price, then use Last. If you want to calculate your own close price, and you want it to include all trades, use Most Recent. By the way, these are two different fields in Level 1 and you can watch both of them.



Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist

Edited by DTN_Gary_Stephen on Aug 25, 2021 at 04:43 PM
 

 

Time: Fri April 19, 2024 8:31 AM CFBB v1.2.0 14 ms.
© AderSoftware 2002-2003