Problem is: I can’t get it to work correctly and think the problem is with BARTypeSignal.
Anyone got any ideas? This code works with 1 dataseries but not 2 dataseries.
thanks
#region Variables
private DataSeries barType;
#endregion
protectedoverridevoid Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Bar, "BARTypeSignal")); // Plot 0
barType = new DataSeries(this); // Relates to whether bar is up/down/flat
}
protectedoverridevoid OnBarUpdate()
{
////-------------SETS THE 2nd SERIES BARS TO +1 FOR UP, -1 FOR DOWN, 0 FOR FLAT----------------------------
if(Closes[1][0] > Opens[1][0])
{barType.Set(1);}
else
if(Closes[1][0] < Opens[1][0])
{barType.Set(-1);}
else
{barType.Set(0);}
////--------------------------------------------------------------------------------------------------------
BARTypeSignal.Set(barType[0]);
}
#region Properties
//--------Plots +1 for Up, -1 for Down, and 0 for Flat---------------------------------\
[Description("Plots the up/down/flat Signal")]
[Category("mySignal")]
public DataSeries BARTypeSignal
{
get { return Values[0]; }
}
#endregion
or is there a better way to approach this with two dataseries?
Comment