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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        28 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        284 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        281 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        132 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X