protected override void OnMarketData(MarketDataEventArgs e) { if (e.MarketDataType == MarketDataType.Last){ Print(e.Price + " : " + e.Last); } }
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
MarketDataEventArgs Last vs. Price
Collapse
X
-
MarketDataEventArgs Last vs. Price
What is the difference between Last and Price in this example?
Code:Tags: None
-
Hello swooke,
Thanks for your post.
MarketDataType.Last means the market data update is the last price at which the trade occurred, not necessarily a bid or ask. Price is the price of that bid/ask/last update. "Last" is not documented for regular use and would not be supported, but it does appear to show the price of the previous update.
Please let us know if we can be of further assistance.JimNinjaTrader Customer Service
-
-
Hello swooke,
BarsInProgress can be used in OnMarketData in the same fashion as in OnBarUpdate. You may test the following to observe in a Multi Time Frame/Instrument NinjaScript:
Code:protected override void OnMarketData(MarketDataEventArgs e) { Print(String.Format("BIP: {0} Instrument.FullName: {1}", BarsInProgress, Instrument.FullName)); }
BIP: 1 Instrument.FullName: ES 03-19
BIP: 0 Instrument.FullName: CL 04-19JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by techgetgame, Yesterday, 11:42 PM
|
0 responses
8 views
0 likes
|
Last Post
by techgetgame
Yesterday, 11:42 PM
|
||
Started by sephichapdson, Yesterday, 11:36 PM
|
0 responses
2 views
0 likes
|
Last Post Yesterday, 11:36 PM | ||
Started by bortz, 11-06-2023, 08:04 AM
|
47 responses
1,613 views
0 likes
|
Last Post
by aligator
Yesterday, 07:22 PM
|
||
Started by jaybedreamin, Yesterday, 05:56 PM
|
0 responses
10 views
0 likes
|
Last Post
by jaybedreamin
Yesterday, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
20 views
0 likes
|
Last Post
by DJ888
Yesterday, 05:12 PM
|
Comment