protected override void OnMarketData(MarketDataEventArgs e)
{
if (e.MarketDataType == MarketDataType.Last){
Print(e.Price + " : " + e.Last);
}
}
Announcement
Collapse
No announcement yet.
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?
The documentation on MarketDataEventArgs does not seem to have an entry for Last but it shows up in intellisense. I just want to confirm that Price is the tick of the actual update. Is Last the previous update?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.
-
-
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)); }Please let us know if you have any questions.BIP: 1 Instrument.FullName: ES 03-19
BIP: 0 Instrument.FullName: CL 04-19
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
232 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
149 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
161 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
243 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
198 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment