public class StochDivergence : Indicator
{
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.DarkGreen), PlotStyle.Line, "Plot0"));
CalculateOnBarClose = false;
Overlay = false;
PriceTypeSupported = false;
}
protected override void OnBarUpdate()
{
// +++++++++++++++++
Values[0].Set(Stochastics(3,5,2).K[0]); //<=== This line
// -------------------------------
}
}
Above code works fine, stochastics %K is displayed on the chart..
But if I change the K[0] to K[1] or other non-zero positive integer value, nothing is displayed on the chart. Stochastics().D[] has the same problem. It seems I can only access current bar's %D abd %K. (According to the manual, D[1] or K[3] should work.)
What do I do wrong? Please help.
Thanks

Comment