When the previus bar is green the count variable[1] should be = 1
when I load it if the previus bar is green , then it consider the count variable[1] = 0 and calculate wrong.
In the chart below you will see it in the last bar
Can you help me please?
CODE
IsSuspendedWhileInactive = true;
AddPlot(new Stroke(Brushes.Black), PlotStyle.Bar,"PlotWeis");
}
else if (State == State.DataLoaded)
Volsum = new Series<double>(this);
Count = new Series<double>(this);
VOL1 = VOL(Close);
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
// Bars
if (Close[0] > Open[0])
{
Count[0] = 1;
}
else if (Close[0] <= Open[0])
{
Count[0] = 0;
}
// Count
if (Count[0] == Count[1])
{
Volsum[0] = Volsum[1] + VOL1[0];
}
else if (Count [0]!= Count[1])
{
Volsum[0] = VOL1[0];
}
PlotWeis[0] = Volsum[0];
// Print(" " +" Data" + Time[0]+ " " +" Count0= " +Count[0] + " ------- " +" Count1= " +Count[1] );
// Color
if (Close[0]>Open[0])
{
PlotBrushes[0][0] = Brushes.Green;
}
if (Close[0]<=Open[0])
{
PlotBrushes[0][0] = Brushes.Red;
}
}
Comment