![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jul 2007
Location: steamboat, co
Posts: 52
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
In OnMarketData() monitor for e.DailyVolume.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: May 2007
Posts: 154
Thanks: 0
Thanked 0 times in 0 posts
|
is this statistic available through/with ZenFire? I get an error trying to access it...
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
|
Yes Jim, I believe it's accessible - what exact error would you get when trying to do so?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: May 2007
Posts: 154
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
|
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);
}
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Mar 2011
Posts: 53
Thanks: 4
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
Join Date: Mar 2011
Posts: 53
Thanks: 4
Thanked 0 times in 0 posts
|
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 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |