View Full Version : Default Plot Width and Location..
nmussa
10-04-2007, 12:16 PM
Is there anyway to set the default size and location of a dot within the Plot() function for an indicator?
Essentially, I would like my PlotStyle.Dot to have a default width of 3 rather than 1. I would also like to place the dot below the bottom of the bar it occurred on and not in the bar.
Your help is much appreciated.
Nick
NinjaTrader_Ray
10-04-2007, 12:27 PM
If your indicator has a single plot, you could add the following line in the Initialize() method after the Add() method.
Plots[0].Pen.Width = 3;
Dots will be plotted at the value that you set for the data series associated to this plot. If you want it plotted at the bottom of the bar, set the value of the data series to the low of the bar.
nmussa
10-16-2007, 06:17 AM
Hi Ray-
This helps me to plot for one of my hour inputs. How do I reference the other 3? I would like them all to default to a larger size.
I am trying to reference them as follows without success. Only the first one plots with a width of 5.
Plots[0].Pen.Width = 5;
Plots[1].Pen.Width = 5;
Plots[2].Pen.Width = 5;
Plots[3].Pen.Width = 5;
Thanks for your help.
Nick
NinjaTrader_Ray
10-16-2007, 06:46 AM
Please paste the code in your Initialize() method. Thanks.
nmussa
10-16-2007, 06:48 AM
Ray-
Thanks again for your help...in posting the code (you) I answered my own question..
Thanks.
++++++++++++++++++++++
Here you go....
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.LawnGreen), PlotStyle.Dot, "RSI_Long"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Dot, "RSI_Long_Div"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "RSI_Short"));
Add(new Plot(Color.FromKnownColor(KnownColor.DarkRed), PlotStyle.Dot, "RSI_Short_Div"));
CalculateOnBarClose = true;
Overlay = true;
PriceTypeSupported = false;
Plots[0].Pen.Width = 5;
Plots[0].Pen.Width = 5;
Plots[0].Pen.Width = 5;
}
NinjaTrader_Ray
10-16-2007, 07:00 AM
Your code is very different that what you have posted in post #3.
You are setting the same index [0] 3 times.
It should be:
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.LawnGreen), PlotStyle.Dot, "RSI_Long"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Dot, "RSI_Long_Div"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "RSI_Short"));
Add(new Plot(Color.FromKnownColor(KnownColor.DarkRed), PlotStyle.Dot, "RSI_Short_Div"));
CalculateOnBarClose = true;
Overlay = true;
PriceTypeSupported = false;
Plots[0].Pen.Width = 5;
Plots[1].Pen.Width = 5;
Plots[2].Pen.Width = 5;
Plots[3].Pen.Width = 5;
}