The goal for the script is to plot a dot on the SMA every time the price crosses it.
It seems though it is not doing that on some down bars (please see attached chart).
I am sure it is something simple and hope somebody can help me out.
Here are the relevant parts of the script:
#region Variables
private int myInput0 = 1; // Default setting for MyInput0
#endregion
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Dot, "Plot0"));
Overlay = true;
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
double curH = High[0];
double curL = Low[0];
if ((SMA(13)[0] > curL) && (SMA(13)[0] < curH))
{
Plot0.Set(SMA(13)[0]);
}
}
#region Properties
[Browsable(false)]
[XmlIgnore()]
public DataSeries Plot0
{
get { return Values[0]; }
}
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
Thanks!!
Comment