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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 04-07-2009, 01:52 PM   #1
auspiv
Member
 
Join Date: Jul 2007
Location: steamboat, co
Posts: 52
Thanks: 0
Thanked 0 times in 0 posts
Default accessing the cumulative volume in t&s window?

is there a method or property to access the cumulative volume that is present in the t&s window? maybe some function or something in OnMarketData()?
Capture.JPG
auspiv is offline  
Reply With Quote
Old 04-07-2009, 01:56 PM   #2
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

In OnMarketData() monitor for e.DailyVolume.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-10-2010, 08:00 AM   #3
Jim-Boulder
Senior Member
 
Join Date: May 2007
Posts: 154
Thanks: 0
Thanked 0 times in 0 posts
Default

is this statistic available through/with ZenFire? I get an error trying to access it...
Jim-Boulder is offline  
Reply With Quote
Old 08-10-2010, 08:18 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

Yes Jim, I believe it's accessible - what exact error would you get when trying to do so?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-10-2010, 09:02 AM   #5
Jim-Boulder
Senior Member
 
Join Date: May 2007
Posts: 154
Thanks: 0
Thanked 0 times in 0 posts
Default Found Error

Thanks for the rapid response,

After your response-I revisited this and discovered the error was in the syntax I was using (imagine that-a user error!!)...for those looking for the same thing I was, the working code is something similar to the following:

if (e.MarketDataType == MarketDataType.Last )

{
dvolume = e.MarketData.DailyVolume.Volume;
}


Can you verify this is the best way to get this statistic? Specifically, is it best to use the "last" event to get this?

J.
Jim-Boulder is offline  
Reply With Quote
Old 08-10-2010, 09:24 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

You're welcome, you could access the DailyVolume event directly as well as part of L1 data -

Code:
 
protectedoverridevoid OnMarketData(MarketDataEventArgs e)
{
if (e.MarketDataType == MarketDataType.DailyVolume) 
Print("DailyVol = " + " " + e.Volume);
}
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-30-2011, 07:51 PM   #7
kashter
Member
 
Join Date: Mar 2011
Posts: 53
Thanks: 4
Thanked 0 times in 0 posts
Default Keep volume value persistent

Hi,
I display the running volume on the chart. However, after cash close, the volume value resets to ETH volume. I need to keep the RTH value persistent after close and not show the ETH volume at all. How do I do that?

Here is my code (but fails to achieve the above)

Code:
protected override void OnMarketData(MarketDataEventArgs e)
		{

			if (e.MarketDataType == MarketDataType.DailyVolume)
			{
				if (Instrument.MasterInstrument.Name == "ES")
				{
					if (ToTime(Time[0]) < 083000)
						ETHsession = e.Volume;
					else if (ToTime(Time[0]) >= 083000 && ToTime(Time[0]) < 151459)
					{
						RTHsession = e.Volume - ETHsession;
						tempVol = RTHsession;
					}
					else if (ToTime(Time[0]) > 151500)
						RTHsession = tempVol;
				}
}
Last edited by kashter; 08-30-2011 at 07:59 PM.
kashter is offline  
Reply With Quote
Old 08-31-2011, 02:03 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

kashter, the general idea is correct : you would need to store the figure needed at your desired time point so you can keep it as a reference then, please add prints in your code to debug why this is not working out as you expect currently.

http://www.ninjatrader.com/support/f...ead.php?t=3418
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-31-2011, 05:42 AM   #9
kashter
Member
 
Join Date: Mar 2011
Posts: 53
Thanks: 4
Thanked 0 times in 0 posts
Default

Hi Bertrand,
Tried the debug but I fail to discover the issue. Will try it out more on the weekend - not much of a coder!
Thx anyway.

K
kashter 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
Cumulative Volume @ Each Price fadertrader SuperDOM and other Order Entry Windows 37 07-09-2010 06:48 PM
Accessing User Choice for Backtest DialogBox Time frame: To & From in Strategy Code? ChiTrader2000 Strategy Development 10 06-06-2009 09:11 AM
Cumulative Volume Or Tick(updowntick/Vol) T2020 NinjaScript File Sharing Discussion 3 03-09-2009 01:23 PM
Cumulative traded volume in Superdom newtrader88 Suggestions And Feedback 1 01-20-2009 09:00 AM
Accessing Bid / Ask Volume at End of Bar PolePosition General Programming 1 04-22-2008 08:57 AM


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