In the code below, lastDotValue and lastDotUpOrDown are dataseries objects. TrailingMark is a plot.
This bit of code is in OnBarUpdate() .. stuff not shown here is minimal.
if (STUFF)
{
DrawDot("MyDot");
lastDotValue.Set(localMax - NumTrailingTicks*myTickSize);
TrailingMark.Set(lastDotValue[0]);
lastDotUpOrDown.Set(1); // 1 for down (blue)
return;
} // end if
if (MORE STUFF)
{
DrawDot("MyDot" + CurrentBar, true, 0, High[0]+1*myTickSize, Color.Orange);
lastDotValue.Set(localMin + NumTrailingTicks*myTickSize);
TrailingMark.Set(lastDotValue[0]);
lastDotUpOrDown.Set(0); // 0 for up (orange)
return;
} // end if
if(lastDotValue.ContainsValue(1))
{
lastDotValue.Set(lastDotValue[1]);
lastDotUpOrDown.Set(lastDotUpOrDown[1]);
} // end if
else
{
lastDotValue.Set(Close[0]);
lastDotUpOrDown.Set(0);
} // end else
TrailingMark.Set(lastDotValue[0]);
What's happening is TrailingMark is not updating when run live. An IF condition will be met, I will GET MY DOT... but the TrailingMark plot is NOT UPDATED. I don't know if this has something to do with overwriting the dataseries objects or if it's my logic here. I have it where if one of the two if blocks are triggered and a dot is printed, then TrailingMark is also updated, and then we return out of OnBarUpdate() before we reach the bottom bit of code (which also sets TrailingMark). Running live it seems like somehow it's always getting to the bottom bit.
Need some help, thanks guys.
Comment