Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Clearing previous plot value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Clearing previous plot value

    Hello,

    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:

    Code:
    			if (pivotLong)
    			{
    		        PivotUp[0] = (Low[0] - pivotOffset);
    			}
    			else if (pivotShort)
    			{
    		        PivotDown[0] = (High[0] + pivotOffset);
    			}
    As a precaution I also added tracking of last pivotLong and pivotShort and added the following to set the last bar on new bar:

    Code:
    			if (CurrentBar != activeBar)
    			{
    				if (lastPivotLong)
    				{
    			        PivotUp[1] = (Low[1] - pivotOffset);
    				}
    				else if (lastPivotShort)
    				{
    			        PivotDown[1] = (High[1] + pivotOffset);
    				}
    				activeBar = CurrentBar;
    			}
    I tried PivotUp.Reset() but that didn't make a difference (same for PivotDown).

    Finally, this is how the plots are added:

    Code:
    				AddPlot(new Stroke(Brushes.MediumSeaGreen, 2), PlotStyle.TriangleUp, "PivotUp");
    				AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.TriangleDown, "PivotDown");
    Thanks.
    Attached Files

    #2
    Figured it out. I needed to do Reset(barsAgo). I was doing Rest without any arguments. Problem solved.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    73 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    152 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X