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, 04: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.
-
Does this work with historical data or is this only realtime? I need to know historical opens and closes.
Comment
-
GetDayBar() docs say:
Does this mean that it will use my session template start and end times to determine the open and close price? If so then these values would be incorrect.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.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
633 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
364 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
567 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment