A NT8 indicator I'm developing is displaying incorrectly when in tick replay mode vs. calculate on close. The indicator plots a triangle up or triangle down based on detected price patterns. The green up triangles should only plot on up bars at pivot bottoms and the red triangles on down bars at pivot tops. As can be seen in the attached images showing correct vs. incorrect rendering, there are arrows plotted on wrong bars (circled a couple only for brevity). I'm assuming in tick replay at one point the bar was in the opposite direction and temporarily satisfied the condition for plotting the triangle, but by close the condition had changed. If so, how do I clear a plot value? I tried setting it to 0 but that just caused it to plot at price value 0 (distorting the chart in the process as it expanded the scale to show 0 at the bottom).
I'm doing the following to set the values during the current bar:
if (pivotLong) { PivotUp[0] = (Low[0] - pivotOffset); } else if (pivotShort) { PivotDown[0] = (High[0] + pivotOffset); }
if (CurrentBar != activeBar) { if (lastPivotLong) { PivotUp[1] = (Low[1] - pivotOffset); } else if (lastPivotShort) { PivotDown[1] = (High[1] + pivotOffset); } activeBar = CurrentBar; }
Finally, this is how the plots are added:
AddPlot(new Stroke(Brushes.MediumSeaGreen, 2), PlotStyle.TriangleUp, "PivotUp"); AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.TriangleDown, "PivotDown");
Comment