I like to plot the high and low of each bar on the right scale like the current price. I have written simple code to do that as below. It works fine, but the only way I am able to plot the high/low values on the right scale is by plotting a dot on the high and low of each bar. I'd prefer to just see the values on the right scale without having to plot dots on the chart as I find this distracting. Is there a way to do that? If I make the dots the same as the background color, it mask a little bit off the high and low of the bar since it is actually overlapping.
-----------------------------------------------------------------
namespace NinjaTrader.Indicator
{
/// <summary>
/// Plot the High and Low of each bar on the right scale
/// </summary>
[Description("Plot the High and Low of each bar on the right scale")]
public class FSIPlotHL : Indicator
{
#region Variables
// Wizard generated variables
private Color HighColor = Color.LimeGreen; // Default setting for HighColor
private Color LowColor = Color.Red; // Default setting for LowColor
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.LimeGreen), PlotStyle.Dot, "HighPlot"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "LowPlot"));
CalculateOnBarClose = false;
Overlay = false;
PriceTypeSupported = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
HighPlot.Set(High[0]);
LowPlot.Set(Low[0]);
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries HighPlot
{
get { return Values[0]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries LowPlot
{
get { return Values[1]; }
}
[XmlIgnore()]
[Description("High Color")]
[Category("Parameters")]
public Color highColor
{
get { return HighColor; }
set { HighColor = value; }
}
// Serialize our Color object
[Browsable(false)]
public string noDemandColorSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString( HighColor); }
set { HighColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
}
[XmlIgnore()]
[Description("Low Color")]
[Category("Parameters")]
public Color lowColor
{
get { return LowColor; }
set { LowColor = value; }
}
// Serialize our Color object
[Browsable(false)]
public string LowColorSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString( LowColor); }
set { LowColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
}
#endregion
}
}
--------------------------------------------------------------------------------
Comment