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
Composite momentum
Collapse
X
-
-
Dear koganam,
its been long time since I asked u for help . I wanted to ask u the following: given an indicator which plots a combination of two other indicators, in my case is that mass flow rate in previous posts, vol/time, is it possible to make NT plot in the same bar the two different indicators? In other words, is it possible to "ask" NT to show me how much each indicator contributes to the single bar? Is it clear what Im saying? I tried to put something like
double mfr = volume[0]/(time[0]);
double vol = volume[0];
Value.Set(mfr);
volume.Set(vol);
PlotColors[0][0] = upColor;
PlotColors[1][0] = dnColor;
where the first should plot the vol/time and the second only the volume, hoping that it would plot the relative percentages in the same bar but clearly it doesnt: if it did I wouldnt be here bothering u
Thank u for ur time (even just for reading it)
Regards
Comment
-
Originally posted by michael fantoni View PostDear koganam,
its been long time since I asked u for help . I wanted to ask u the following: given an indicator which plots a combination of two other indicators, in my case is that mass flow rate in previous posts, vol/time, is it possible to make NT plot in the same bar the two different indicators? In other words, is it possible to "ask" NT to show me how much each indicator contributes to the single bar? Is it clear what Im saying? I tried to put something like
double mfr = volume[0]/(time[0]);
double vol = volume[0];
Value.Set(mfr);
volume.Set(vol);
PlotColors[0][0] = upColor;
PlotColors[1][0] = dnColor;
where the first should plot the vol/time and the second only the volume, hoping that it would plot the relative percentages in the same bar but clearly it doesnt: if it did I wouldnt be here bothering u
Thank u for ur time (even just for reading it)
Regards
Which plot are you missing?
What errors are noted in the log?
Comment
-
Hello koganam,
thank u for replying!!
There r not errors whatsoever in the log: no outside range, nothing! Its not plotting the volume, I only get the vol/time, in green, the upColor: I checked the values of the bars against it the other indicator I had in the Data Box
I post the script so u can see it:
{
[Description(" blabla")]
public class MassFlowRate2 : Indicator
{
#region Variables
private DataSeries volume;
private DataSeries mfr;
private Color upColor = Color.Green;
private Color dnColor = Color.Red;
#endregion
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Red, 9), PlotStyle.Bar, "mfr"));
Add(new Plot(new Pen(Color.Blue, 9), PlotStyle.Line, "volume"));
mfr = new DataSeries(this);
volume = new DataSeries(this);
}
protected override void OnBarUpdate()
{
if (CurrentBar==0)
{
mfr.Set(0);
volume.Set(0);
Value.Set(0);
}
else
{
mfr.Set((Time[0]-Time[1]).TotalMinutes);
volume.Set(Volume[0]);
double mfr2 = Volume[0]/(mfr[0]);
double vol = Volume[0];
Value.Set(mfr2);
volume.Set(vol);
PlotColors[0][0] = upColor;
PlotColors[1][0] = dnColor;
}}
}}
Comment
-
Originally posted by michael fantoni View PostHello koganam,
thank u for replying!!
There r not errors whatsoever in the log: no outside range, nothing! Its not plotting the volume, I only get the vol/time, in green, the upColor: I checked the values of the bars against it the other indicator I had in the Data Box
I post the script so u can see it:
{
[Description(" blabla")]
public class MassFlowRate2 : Indicator
{
#region Variables
private DataSeries volume;
private DataSeries mfr;
private Color upColor = Color.Green;
private Color dnColor = Color.Red;
#endregion
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Red, 9), PlotStyle.Bar, "mfr"));
Add(new Plot(new Pen(Color.Blue, 9), PlotStyle.Line, "volume"));
mfr = new DataSeries(this);
volume = new DataSeries(this);
}
protected override void OnBarUpdate()
{
if (CurrentBar==0)
{
mfr.Set(0);
volume.Set(0);
Value.Set(0);
}
else
{
mfr.Set((Time[0]-Time[1]).TotalMinutes);
volume.Set(Volume[0]);
double mfr2 = Volume[0]/(mfr[0]);
double vol = Volume[0];
Value.Set(mfr2);
volume.Set(vol);
PlotColors[0][0] = upColor;
PlotColors[1][0] = dnColor;
}}
}}
Comment
-
-
Also, I did name the plots the same as the series cos originally I thought that was the problem: I only get one plot if I name the plots differently!
Comment
-
Yep, I saw that a bit later
But I dont understand. I looked at the default MACD bundled with NT and it plots all of them. If u had 2 dataseries named alpha and beta, how would u go about plotting? wouldnt u write what I did?
Also, it would be nice if I could choose not to get log off the forum while Im banging on the script
Comment
-
OHHHHHHHHHHHHHH!!! Finally! It works! I can plot them both and see how big one wrt the other! I attach it just in case u want to have a look at it. It doesnt say much but I needed to compare things on the same bar.
Thank u for all the support koganam!
Take careAttached Files
Comment
-
Originally posted by michael fantoni View PostOHHHHHHHHHHHHHH!!! Finally! It works! I can plot them both and see how big one wrt the other! I attach it just in case u want to have a look at it. It doesnt say much but I needed to compare things on the same bar.
Thank u for all the support koganam!
Take care
Glad that I could help.
Comment
-
Hello there!
hope all gd!
I would have a quick question and I havent found the topic in the forum. How could I tell NT to take the factorial of a quantity when building an indicator, the usual n! found in maths?
Regards
Comment
-
Originally posted by michael fantoni View PostHello there!
hope all gd!
I would have a quick question and I havent found the topic in the forum. How could I tell NT to take the factorial of a quantity when building an indicator, the usual n! found in maths?
Regards
Comment
-
Hello koganam
I would like to take the factorial of lets say the WMA(Close,1)[0]. I know there is a limit to how big a number I can take the factorial of. But for prices around 1-10 units that should work. How could I go round it?
Thank u
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mly916, Today, 09:48 PM
|
0 responses
10 views
0 likes
|
Last Post
by mly916
Today, 09:48 PM
|
||
Started by Mikey_, Today, 09:21 PM
|
0 responses
11 views
0 likes
|
Last Post
by Mikey_
Today, 09:21 PM
|
||
Started by cre8able, Today, 05:53 PM
|
3 responses
13 views
0 likes
|
Last Post
by cre8able
Today, 09:20 PM
|
||
Started by Aryan Kumar, Today, 09:04 PM
|
0 responses
4 views
0 likes
|
Last Post
by Aryan Kumar
Today, 09:04 PM
|
||
Started by yertle, Yesterday, 05:49 PM
|
3 responses
16 views
0 likes
|
Last Post
by Mindset
Today, 08:38 PM
|
Comment