![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
|
Is the data in T&S the same as OnMarketData()?
|
|
|
|
|
|
#2 |
|
Senior Member
|
so, in the time & sales window, what is displayed is the last price, last volume? and that comes from marketdepth()? 'cause I can't get last price and volume from marketdepth, I need to get it from marketdata, right?
|
|
|
|
|
|
#3 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
funk101,
Sorry for the misinformation. Please take a look at this screenshot: http://i36.tinypic.com/35d3yjb.png You will notice the corresponding numbering related to the T&S window representing last prices. The color scheme I have on the T&S is if the background is green the price is at the ask, if the background is red the price is at the bid. Pink text means below the bid and lime text means above the ask. You can see everything matches up and coloring is all accurate based on the outputs. You will use OnMarketData() and T&S shows last price, last volume.
Josh
NinjaTrader Customer Service
Last edited by NinjaTrader_Josh; 09-24-2008 at 09:34 AM.
|
|
|
|
|
|
#4 |
|
Senior Member
|
Ok, so I DO NOT user marketdepth, I use marketdata. Thanks for the correction.
|
|
|
|
|
|
#5 |
|
Senior Member
|
I'm sure I just haven't figured it out, but, T&S can spit out multiple orders in one 250ms shot, when I print to output window, it gives me the same spurt of data, like for instance, 5 trades at ES 1184.50 with diff. volumes, however, the very same code, which basically calls OnMarketData() and looks for the lastPrice and lastVolume; When I display it in a DrawText(), will ONLY give me the very LAST of the *lastPrices, and *lastVolumes. I would like to get ALL the trades I see in the output window into a loop of DrawText(), as if I could do a for() loop on the lastPrice, but it's not an array. Hmm.
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
funk101,
You get all of the exact same events in T&S as you do in OnMarketData(). As demonstrated in my earlier post, you can find all updates present and accounted for. As for what shows up on displays please see if modifying the chart properties for the "Display update interval" helps. Note: this will make it much more CPU intensive.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
|
Please check image. T&S shows 3 trades happening at 10:16:58AM - 1183.75, with 3 diff vols: 4, 13, 12, however in my OnMarketData(), I only get the *last* entry. I want to display *exactly* those 3 trades like in the T&S:
(dummied code sample) protected override void OnMarketData(MarketDataEventArgs e) { if (e.MarketData.Last == null) return; if (e.MarketData.Last.Price == e.MarketData.Bid.Price) { DrawText("spread",false,e.MarketData.Last.Price.To String()+"@"+e.MarketData.Last.Vol.ToString(), (int)gBoundsX+40, yPos, txtColor, gSpreadFont, StringAlignment.Center, outlineColor, gLargeTradeColor, 10); } } |
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
If you only print one line like that it will only print out the latest value. If you want it to print out more lines you simply need to save those previous data points and print additional lines.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#9 | |
|
Senior Member
Join Date: Apr 2008
Posts: 123
Thanks: 0
Thanked 1 time in 1 post
|
Josh,
Is the below method the only way to distinguish idf a trade occurred At Bid and is that how you manage your color coding or the exchange provides that info? if (e.MarketData.Last.Price == e.MarketData.Bid.Price) thanks Quote:
|
|
|
|
|
|
|
#10 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
What you need to do is create local variables in your indicator such as:
private double lastBidPrice; then in OnMarketData() when e.MarketDataType == MarketDataType.Bid assign the value e.Price to this variable. Then when e.MarketDataType == MarketDataType.Last, compare e.Price to this variable.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#11 | |
|
Senior Member
Join Date: Apr 2008
Posts: 123
Thanks: 0
Thanked 1 time in 1 post
|
thanks for the quick response, that's what had occurred to me but needed to make sure that the exchanges through the feed do NOT supply the data already tagged as at bid or at ask etc.
BTW, here's an relevant question maybe I could get an answer for. How can a trade occur for the eminis at say between the bid and the ask? In order to buy or sell there must exist an offer or a bid first, or NOT? I understand the below and the above but not the between?! Anybody? Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Time and Sales and DOM data | SuzyG | General Programming | 9 | 01-25-2012 03:07 AM |
| Time and Sales | stevescott05 | Suggestions And Feedback | 3 | 05-03-2011 01:49 AM |
| Time and Sales | RedDuke | Indicator Development | 10 | 04-27-2008 01:23 PM |
| Time & Sales | jajuanm2 | Miscellaneous Support | 1 | 01-30-2008 04:51 PM |
| Time and Sales for Eurex | beginner | Miscellaneous Support | 7 | 07-16-2007 09:02 AM |