I've written a simple indicator that sets price highs and lows. I'd like to reuse those values as input for other indicators. Unfortunately when I try to access those values I'm only getting back the Close[0]. What could cause that?
Here's the code:
public class A1PNV : Indicator
{
#region Variables
private DataSeries pricePeak;
private DataSeries priceValley;
#endregion
protected override void Initialize()
{
Overlay = true;
pricePeak = new DataSeries(this);
priceValley = new DataSeries(this);
}
protected override void OnBarUpdate()
{
pricePeak.Set(Peak_Value(High,Open,Close));
priceValley.Set(Valley_Value(Low, Open, Close));
}
#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 Price_Peak
{
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 Price_Valley
{
get { return Values[1]; }
}
#endregion
protected override void OnBarUpdate()
{
A1PNV pnv = A1PNV();
double pp = pnv.Price_Peak[0];
}
The A1PNV indicator works fine on its own. It's only when I try to reference it in another indicator that I'm having an issue. Any help would be greatly appreciated.

Comment