Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to skip a value in AddPlot

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

    how to skip a value in AddPlot

    Hello everybody,

    I am using AddPlot to draw an indicator into my price chart which I use as a trailing stop-loss. Please ignore the numbers below the bars, they are only for debugging purposes and visible in this screenshot. In the shown example the trailing stop line jumps above the bar because the trend has reversed:

    Click image for larger version  Name:	skip_drawing.png Views:	0 Size:	9.7 KB ID:	1126182

    This jump is drawn but I want to skip this part. I have shown it with yellow color in the above screenshot for better visualization. How can I remove/skip this yellow part of my plot? My goal is to have a gap at this bar. The code I use for drawing the line is simply:

    Code:
    [...]
        protected override void OnBarUpdate()
    {
    if (CurrentBar < 2) return;
    {
    [...]
    if ( trendDir == 1 )
    trail = Low[1];
    if ( trendDir == -1 )
    trail = High[1];
    Value[0] = trail;
    I tried assigning Value[0] = null; but that doesn't seem to be valid code.

    How can I solve this? any help appreciated.
    Thanks in advance.

    #2
    Hello patricia70,
    You can do this by changing your plot style from line to dot / block / hash / cross. If you want line then 2 plots will be required & based on your condition you can assign value to the one needed.

    Comment


      #3
      Hello patricia70,

      Thank you for your post.

      If you wish to not plot a value for a particular bar, you can simply just not assign a value to Value[0] for that bar, then on the next bar assign a value. Alternately, if you want values plotted on every bar you could use 2 separate plots, one for the upper and one for the lower line. This example from our help guide shows using multiple plots that you could modify to fit your needs:



      Please let us know if we may be of further assistance to you.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      656 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      371 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      579 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X