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
Confused by output of onMarketData
Collapse
X
-
Hello Cilla,
Thank you for your reply.
Viewing the T&S window will show you that it's possible for multiple trades to occur at a given bid/ask price and not necessarily change the price instantly. This is why we offer the Calculate property of OnPriceChange in contrast to OnEachTick. A single tick of a market doesn't guarantee a price change, so that could improve the performance of your script because it calls OnBarUpdate less often.
Please let me know if I can assist further.
-
Hi Chris - thanks for your answer.
I've looked at the T&S window and that appears to report the same stream of data that my code does, but with some timestamp information included. Are you saying that some trades can occur at e.g. the ask without affecting the ask volume, even though the ask price stays the same?
Leave a comment:
-
Hello Cilla,
Thank you for your post and welcome to the NinjaTrader forum!
When you come across the Last MarketDataType that will be the volume and price the stock or commodity was actually traded at. Not all volume on either the bid or ask side of the market is guaranteed to be filled. This can be visualized with the T&S window. The current bid and ask volume can be seen at the top and there is a stream of trades that are occurring in real time where the volume "trickles" in.
Please let me know if I can assist further.
Leave a comment:
-
Confused by output of onMarketData
Hi
I'm trying to understand some of the output of OnMarketData in which I think I see more traded volume at the Ask than available volume at the Ask. I ran the following code against YM 06-19 future:
protected override void OnMarketData(MarketDataEventArgs e)
{if (e.MarketDataType == MarketDataType.Last){Print("Last: " + e.Volume + " @ " + e.Price);}else if (e.MarketDataType == MarketDataType.Ask) {var diff = e.Volume - lastVolAtAsk;Print("Ask: " + diff + " to " + e.Volume + " @ " + e.Price);lastVolAtAsk=e.Volume;}else if (e.MarketDataType == MarketDataType.Bid) {var diff = e.Volume - lastVolAtBid;Print("Bid: " + diff + " to " + e.Volume + " @ " + e.Price);lastVolAtBid=e.Volume;}}
The output I don't understand:
Ask: -1 to 15 @ 25989
Bid: 1 to 5 @ 25988
Bid: 1 to 6 @ 25988
Bid: 1 to 7 @ 25988
Ask: -1 to 14 @ 25989
Bid: 1 to 8 @ 25988
Bid: -1 to 7 @ 25988
Ask: -1 to 13 @ 25989
Bid: -1 to 6 @ 25988
Last: 1 @ 25989
Last: 1 @ 25989
Last: 1 @ 25989
Last: 14 @ 25989
Ask: -7 to 6 @ 25990
Bid: 1 to 7 @ 25988
Bid: 1 to 8 @ 25988
Ask: 1 to 7 @ 25990
Bid: 1 to 9 @ 25988
Bid: -1 to 8 @ 25988
So, it looks to me like there were 17 contracts traded at the Ask (25989) when there was only an ask volume of 13 available.
Please could someone help me make sense of this.
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mattbsea, Today, 05:44 PM
|
0 responses
4 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
31 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
2 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,282 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
2 responses
20 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
Leave a comment: