One way to filter is to set a plot value as 1 when the conditions are true and 0 otherwise. You can then check against a value of 1 for this indicator in the market analyzer. This allows you to use bool conditions for your filter, rather than trying to identify a reasonable value to scan for.
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
% Change in Average Volume
Collapse
X
-
It's really up to you. First identify what you're looking for and then start breaking it down into objective rules the computer can follow. Start simple and add complexity once you've verified it works as you expect.
One way to filter is to set a plot value as 1 when the conditions are true and 0 otherwise. You can then check against a value of 1 for this indicator in the market analyzer. This allows you to use bool conditions for your filter, rather than trying to identify a reasonable value to scan for.Ryan M.NinjaTrader Customer Service
-
hmmm, would something like this work?
----------------------------------------------------------------
protected override void OnBarUpdate()
{
if (ToTime(Time[0]) <= ToTime(9, 45, 00) && Volume[0] > 288000)
if (ToTime(Time[0]) <= ToTime(10, 00, 00) && Volume[0] > 576000)
{
Plot0.Set(1);
}
else
{
Plot0.Set(0);
}
Comment
-
Yes, that's the right idea for setting plot values but your conditions will need some work.
if (ToTime(Time[0]) <= ToTime(9, 45, 00) && Volume[0] > 288000)
if (ToTime(Time[0]) <= ToTime(10, 00, 00) && Volume[0] > 576000)
That says if the first line evaluates true, start evaluating the second line. You will then not receive any true conditions after 9:45, since the first condition excludes everything beyond this time frame.
One approach around this is coding sequences with bool flags, but this will get messy if you're doing it for every 15 minute block.
I see what you're trying to solve but unfortunately I'm not aware of a simple solution. If you're looking to have this professionally done, a NinjaScript consultant should be able to assist.Ryan M.NinjaTrader Customer Service
Comment
-
Okay, Thanks Ryan
I have contacted a few NT coders to see what they say, I need another indicator I know I can't do just caught up in the challenge of this one
I will try to make this my last question on the subject....
Is it possible to create a starting point for a moving average? If I could get an SMA to start fresh each new day/session I think I can do it....
Thanks,
R.T.
Comment
-
Hi Bertrand,
Thanks! This seems to work... do I have to define a period for the SMA or is this automatically creating the SMA for the session? In other words as new bars are added during the session is the SMA automatically going from a first bar of session one period SMA to a 2nd bar 2 period SMA and so forth?
Thanks again!
Comment
-
okay, well I changed the code to
Plot0.Set(SMA(Volume, Bars.BarsSinceSession + 1)[0]);
so that is giving me the session ema on volume right?
Comment
-
Awesome! I think this is going to work then for an on pace volume, at least it does in my head and looking at the charts it seems to...
so is the session it is calculating off of what I have set in my data series for the chart? I might be able to nail the last indicator I need from this code as well.
Thanks for all the help guys! I really appreciate it, hope you guys have a great New Year!
R.T.
Comment
-
Man, I feel I am close to the final indicator I need...
I got the summing of volume for the session, I just need the SMA to follow in session or add to itself the way the on pace does.
Here is what I have so far
Plot0.Set(((SUM(Volume, Bars.BarsSinceSession + 1)[0] - SMA(Volume, 390)[0]) / SMA(Volume, 390)[0]) * 100);
any idea on how I can get the SMA(Volume, 390)[0]) figure to add to itelf during the session?
Comment
-
Hi Josh, Thanks for the reply...
What I mean by "in session" is this snippet...
(SMA(Volume, Bars.BarsSinceSession + 1)[0]);
I need to take the 30 day volume SMA and divide by 13 and then have that number be added to each new 30 minute bar of the session...
Comment
-
So you want the SMA of the current session only? There is no way to just limit an indicator to only one session like that. If you want that calculation you will need to roll in your own SMA logic instead of calling the SMA() indicator and only run it on the bars of the current session.Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by dcriador, Today, 09:33 AM
|
0 responses
1 view
0 likes
|
Last Post
by dcriador
Today, 09:33 AM
|
||
Started by dcriador, Yesterday, 10:45 AM
|
4 responses
29 views
0 likes
|
Last Post
by dcriador
Today, 09:30 AM
|
||
Started by reynoldsn, Today, 09:01 AM
|
2 responses
7 views
0 likes
|
Last Post
by reynoldsn
Today, 09:27 AM
|
||
Started by dcriador, Yesterday, 08:56 AM
|
2 responses
23 views
0 likes
|
Last Post
by dcriador
Today, 09:26 AM
|
||
Started by Haiasi, Today, 09:16 AM
|
1 response
4 views
0 likes
|
Last Post Today, 09:26 AM |
Comment