I got this error message "Error on calling 'OnBarUpdate' method on bar 12: Object reference not set to an instance of an object."
What does this actually mean?
Here's the code:-
protected override void OnBarUpdate()
{
if (CurrentBar < (level*2 + 10)) return;
// Identify the first pivot low
if((Low[1] < Low[0]) && (Low[1] < Low[2]))
{
DemandPoint0 = Low[1];
DemandPoint0Y = 1;
Draw.Dot(this, "DPDot", true, DemandPoint0Y, DemandPoint0, Brushes.Red, true);
}
// Hunting for a lower pivot low that has already occurred which meets the same pivot low condition and to draw a ray connecting the 2 points
for( int x = 2; x <= 100; x++)
{
if ((Low[x] < Low[x-1]) && (Low[x] < Low[x+1]))
{
if (Low[x] < DemandPoint0)
{
Draw.Ray(this, "DPL1", true, x, Low[x], DemandPoint0Y, DemandPoint0, Brushes.Pink, DashStyleHelper.Solid, 1);
}
}
}
}
Kay Wai

Comment