Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to get official open and close price?
Collapse
X
-
How to get official open and close price?
I have a session template that shows me an hour before the market open and 30 minutes after the close (e.g. from 8:30am EST to 4:30pm EST). From within code how can I get the official exchange opening price at 9:30am EST and closing price at 4:00pm for stocks?Last edited by overflowing; 07-25-2012, 03:56 PM. -
overflowing, you can work with those OnMarketData event args - http://www.ninjatrader.com/support/h...aeventargs.htm
You would need to store the data needed to variables and access those in your OnBarUpdate() then.BertrandNinjaTrader Customer Service
-
Does this work with historical data or is this only realtime? I need to know historical opens and closes.
Comment
-
This would be realtime going forward as offered directly from your provider. For historical data, you would need to use GetBar for example :
http://www.ninjatrader.com/support/h...nt7/getbar.htm
Or GetDayBar :
http://www.ninjatrader.com/support/h.../getdaybar.htmBertrandNinjaTrader Customer Service
Comment
-
GetDayBar() docs say:
This bar is a virtual bar built off of the underlying data series. In some cases, the trading day bar can be used to represent a daily bar. Since this bar is virtual, its property values are calculated based on session definitions contained in the trading day only. This does not necessarily represent the actual day.
I'm wondering if I should add an additional Day type dataseries and use that to get the open and close?
Comment
-
With GetBar() I would be getting the open price at 9:30AM EST, however not all stocks open at precisely 9:30. So if I use this method then its possible I might get the price at 9:30AM but not the official opening price, correct?
If I use a Day series will this give me the correct opening? I believe day data is handled differently from intraday data. Assuming this gives the exchange opening price it seems this would be the only way to get the correct opening price.
Comment
-
Correct, with GetBar() you would need additional checks if you have a late opening stock then.
Besides using an added daily series, you can check into our pivots indicator - it loads Day bars asynchronously using non NinjaScript methods, check under it's custom methods implemented under the misc section in the code.BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pjsmith, Today, 02:42 AM
|
0 responses
2 views
0 likes
|
Last Post
![]()
by pjsmith
Today, 02:42 AM
|
||
Started by moyerchopra, Yesterday, 11:43 PM
|
0 responses
1 view
0 likes
|
Last Post
![]()
by moyerchopra
Yesterday, 11:43 PM
|
||
Started by ttodua, Yesterday, 11:40 PM
|
0 responses
2 views
0 likes
|
Last Post
![]()
by ttodua
Yesterday, 11:40 PM
|
||
Started by edmata1109, 12-04-2019, 09:19 PM
|
8 responses
28 views
0 likes
|
Last Post
![]()
by koganam
Yesterday, 10:15 PM
|
||
Started by maindoor, 12-03-2019, 10:45 PM
|
9 responses
64 views
0 likes
|
Last Post
![]()
by koganam
Yesterday, 10:11 PM
|
Comment