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
Daily Volume indicator
Collapse
X
-
Hello Tomass, thanks for your question.
The OnMarketData method can be overridden for the daily volume. e.g.
Code:double DailyVol; protected override void OnMarketData(MarketDataEventArgs marketDataUpdate) { if (marketDataUpdate.MarketDataType == MarketDataType.DailyVolume) DailyVol = marketDataUpdate.Volume; }
Chris L.NinjaTrader Customer Service
-
Thank you very much. I am used to NT7 and kinda starting with NT8, can you please advice me any example of indicator using marketDataUpdate.Volume, or any other indicator that I can try to reverse engineer it? Basically I am trying to achive Volume indicator (similar to VolumeUpDown), but instead of volume on each tick it will be compounding volume of day, like in DailyVolume in market Analyzer. Hope it makes sence and will be glad for any advice to make this work. Thank you for your patience and time.
Comment
-
Hi Tomass, thanks for your reply.
It could be done like the example attached. Note the DailyVolume will only be available in real time data. To get this information in historical mode one would need to manually accumulate the volume data from the beginning of each session with the MarketDataType.Last data type. See this page for more details on tick replay.
Kind regards.Attached FilesChris L.NinjaTrader Customer Service
Comment
-
Hi Chris,
I do need the DailyVolume for historical data in one of my indicators. You have attached a link, which indicates that the Tick Replay must be used. I have an indicator that only Calculates OnClose and for performance reason i avoid Tick Replay. Is there a way to get the DailyVolume for historical data without Tick Replay?
Thx.
Comment
-
Hi Stefan, unfortunately, to get this exact MarketDataType.DailyVolume value from OnMarketData historically you do need to use tick replay to get this piece of information. The alternative is to use AddDataSeries() to add a daily series, then take the Volume information from that series.
if(BarsInProgress == 1)
{
Print(Volumes[1][0] + " " + Times[1][0]);
}Chris L.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHi Tomass, thanks for your reply.
It could be done like the example attached. Note the DailyVolume will only be available in real time data. To get this information in historical mode one would need to manually accumulate the volume data from the beginning of each session with the MarketDataType.Last data type. See this page for more details on tick replay.
Kind regards.
This script is awesome. How could it be transformed to calculate the daily average traffic for the past x days, and then, using this script, compute a percentage value from the quotient of the two in terms of what percentage of the average has already been achieved in this session? And to display this in the same way on a plot line chart?
Thank you,
David
- Likes 1
Comment
-
Hello David,
You can use a loop to accumulate the Volume of bars to a variable.
private double accumulatedVolume;
for (int index = 0; index < 10; index++)
{
accumulatedVolume += Volume[index];
}
If you want to divide the current bars Volume[0] with the accumulatedVolume this would appear as:
Volume[0] / accumulatedVolume
Below is a link to a support article on adding plots and setting the value.
Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by johntraderuser2, Today, 02:34 AM
|
0 responses
6 views
0 likes
|
Last Post Today, 02:34 AM | ||
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
12 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
4 views
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
||
Started by gleichnerany, Today, 01:17 AM
|
0 responses
5 views
0 likes
|
Last Post
by gleichnerany
Today, 01:17 AM
|
||
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
47 views
0 likes
|
Last Post Today, 12:28 AM |
Comment