Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Brushes in OnBarUpdate

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

    Brushes in OnBarUpdate

    I have 2 plots with brushes in initialize. In OnBarUpdate I want to change their color when they are both above or below 0. When I write this I get the 'cannot convert double to brushes' error.

    What is the correct way to write this? I looked on the forum for this answer but couldn't locate.

    Thank you.

    #2
    Did You try this way?

    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      I have two conditions. When one condition is true I want to color the bar or line blue. I want it to remain blue until the second condition is true. When the second condition is true I want to change to a different color and remain this different color until the first condition is true again. I want to go back and forth between these two colors.

      How do I write this?
      Thank you.

      Comment


        #4
        Hello imalil,

        You can use PlotBrushes to change the color of a Plot, and you can use BarBrushes to change the color of a Bar. You can write a condition that sets a color, and then keeps track of the CurrentBar number of when that color was set. And then in another condition where you wish to change that bar or plot to a different color, you can subtract the stored CurrentBar value from the current CurrentBar value. This gives you how many bars ago that bar was changed, and this barAgo value can be used in PlotBrushes or BarBrushes to change the bar color you set previously.

        CurrentBar - https://ninjatrader.com/support/help...currentbar.htm

        BarBrushes - https://ninjatrader.com/support/help...barbrushes.htm

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        46 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        28 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X