Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by joselube001, 05-10-2024, 12:17 PM
        6 responses
        27 views
        0 likes
        Last Post joselube001  
        Started by bigc0220, 09-18-2018, 09:16 AM
        6 responses
        2,579 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by lorem, 04-25-2024, 09:18 AM
        18 responses
        78 views
        0 likes
        Last Post lorem
        by lorem
         
        Started by DawnTreader, 05-08-2024, 05:58 PM
        21 responses
        81 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by doihaveto13, Today, 12:46 PM
        2 responses
        5 views
        0 likes
        Last Post doihaveto13  
        Working...
        X