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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        57 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        78 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        41 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        101 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        61 views
        0 likes
        Last Post PaulMohn  
        Working...
        X