but Close[1] returns nothing ?
i have lots of data, i can see that Close[0] is 74.34, and prev close is 74.32
see the bottom of the code snippet
[Description("test/tutorial trying to replicate MO, from QT")]
public class VolSMA : Indicator
{
#region Variables
// Wizard generated variables
private int period = 10; // Default setting for Period
// 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.Green), PlotStyle.Bar, "Plot0"));
Add(new Line(Color.FromKnownColor(KnownColor.DarkOliveGree n), 0, "Line1"));
Add(new Line(Color.FromKnownColor(KnownColor.Khaki), 0, "Line2"));
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// double average = SMA(VOL(),Period)[0];
double average = Momentum(Close,14)[0]-Momentum(Close,10)[0];
average = Close[0] ; /// this works fine, unless i have the following:
average = Close[1] ; /// this generates NO lines or data
Plot0.Set(average);
}
Comment