Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot Brushes on Previous Bar

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

    Plot Brushes on Previous Bar

    How do you get it to plot from previous bar instead of the current bar. (see attached photo) I want those dots to plot in the previous bar instead.

    This is how the code looks like at the moment.

    Code:
    if(CurrentBar < 20) return;
    
    ta = (High[0] + 1 * TickSize);
    
    tb = (Low[0] - 1 * TickSize);
    
    TickAbove[0] = ta;
    TickBelow[0] = tb;
    
    if(CurrentBar < 1)
    return;
    
    PlotBrushes[0][1] = Brushes.Transparent;
    PlotBrushes[1][1] = Brushes.Transparent;
    Attached Files

    #2
    Figured it out, I just set the calculate on bar close. Not sure if that's the proper way, but it works.

    Comment


      #3
      Hello Johndc,

      Thank you for your reply.

      The correct way to ensure your plots are on the bar prior to the one currently forming when running OnEachTick or OnPriceChange would be to use a BarsAgo index when assigning values to your plots. So, for example, if I wanted to set values for the prior bar instead of the currently forming bar, I can use a BarsAgo value of 1:


      TickAbove[1] = ta;
      TickBelow[1] = tb;

      If I wanted to set it for 2 bars ago, I would change the 1 to a 2, 3 bars ago, it would be a 3, and so on.

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

      Comment


        #4
        Thanks Kate!

        Also, if it's not too much ask, can you please give me an example how to create a user defined input so I dont have to keep changing them in the editor.
        Code:
        ta = (High[0] + 1 * TickSize);
        tb = (Low[0] - 1 * TickSize);
        Last edited by Johndc; 04-08-2022, 05:14 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X