NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 09-24-2008, 07:01 AM   #1
funk101
Senior Member
 
Join Date: Jan 2006
Location: Margate, Florida, USA
Posts: 426
Thanks: 0
Thanked 2 times in 2 posts
Send a message via AIM to funk101
Default Time and Sales

Is the data in T&S the same as OnMarketData()?
funk101 is offline  
Reply With Quote
Old 09-24-2008, 09:13 AM   #2
funk101
Senior Member
 
Join Date: Jan 2006
Location: Margate, Florida, USA
Posts: 426
Thanks: 0
Thanked 2 times in 2 posts
Send a message via AIM to funk101
Default re: marketdepth t&s data

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?
funk101 is offline  
Reply With Quote
Old 09-24-2008, 09:30 AM   #3
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

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.
Last edited by NinjaTrader_Josh; 09-24-2008 at 09:34 AM.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-24-2008, 12:45 PM   #4
funk101
Senior Member
 
Join Date: Jan 2006
Location: Margate, Florida, USA
Posts: 426
Thanks: 0
Thanked 2 times in 2 posts
Send a message via AIM to funk101
Default ah

Ok, so I DO NOT user marketdepth, I use marketdata. Thanks for the correction.
funk101 is offline  
Reply With Quote
Old 09-24-2008, 03:52 PM   #5
funk101
Senior Member
 
Join Date: Jan 2006
Location: Margate, Florida, USA
Posts: 426
Thanks: 0
Thanked 2 times in 2 posts
Send a message via AIM to funk101
Default T&S and Print to Output vs OnMarketData()

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.
funk101 is offline  
Reply With Quote
Old 09-24-2008, 04:14 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

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.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-24-2008, 10:50 PM   #7
funk101
Senior Member
 
Join Date: Jan 2006
Location: Margate, Florida, USA
Posts: 426
Thanks: 0
Thanked 2 times in 2 posts
Send a message via AIM to funk101
Default re: T&S...

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);
}
}
Attached Images
File Type: gif marketData.png (72.8 KB, 186 views)
funk101 is offline  
Reply With Quote
Old 09-25-2008, 08:12 AM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

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.
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-10-2008, 11:16 PM   #9
mktrend
Senior Member
 
Join Date: Apr 2008
Posts: 123
Thanks: 0
Thanked 1 time in 1 post
Default

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:
Originally Posted by NinjaTrader_Josh View Post
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.
mktrend is offline  
Reply With Quote
Old 10-11-2008, 07:39 AM   #10
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

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.
NinjaTrader_Ray is offline  
Reply With Quote
Old 10-11-2008, 12:33 PM   #11
mktrend
Senior Member
 
Join Date: Apr 2008
Posts: 123
Thanks: 0
Thanked 1 time in 1 post
Default

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:
Originally Posted by NinjaTrader_Ray View Post
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.
mktrend is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 12:05 PM.