Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change colours of bars

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

    Change colours of bars

    Hi,

    My apologies if this is a simple question but I've searched around and can't work out how to change the colours of the bars on a chart. Basically I am looking to have:

    up bar : green
    down bar : red
    outside bar : blue
    inside bar : black

    I tried using "BarColorSeries[0] = Color.Green" when a bar met my criteria for an up bar (and the equivalent for the others), but nothing changed on the chart.

    Any advice you could give me would be much appreciated.

    Regards,
    Kylie.

    #2
    kylie, I would first suggest working with BarColor here, and then only use the series should you need to change a color retrospectively... http://www.ninjatrader.com/support/h...7/barcolor.htm

    Also ensure your rules for triggering the color change are hitting, if nothing plots it could be a sign that they don't evaluate to 'true' leading to your expected bar color change.

    Comment


      #3
      Hi Bernard,

      Thank you for the suggestion. You were right. The logic is falling over because I do a compare of High[0] to High[1] which obviously fails on the first bar. I haven't written many Indicators before so I am not sure how to get around this. In Strategies, you have the setting to say how many bars to leave before you start the logic, but I can't find anything equivalent for Indicators.

      Can you please provide some advice on how to get it to ignore the first bar on the chart?

      Regards,
      Kylie.

      Comment


        #4
        You're welcome Kylie, you could apply the snippets / tips shared here to your script :

        Comment


          #5
          Hi Bertrand,

          Thankyou for the advice - so simple I should have thought of it myself! My colours appear to all be plotting correctly now.

          Regards,
          Kylie.

          Comment


            #6
            Hi there Kylie,

            I'm just wondering if you ended up getting this to work? I'm looking to do the exact same thing with NinjaTrader regarding bar colors.

            (up bar : green
            down bar : red
            outside bar : blue
            inside bar : black)

            I have no experience with the program though or creating scripts. Are you able to provide me with the script or something that I can import into the program to allow me to have the same bar setup?

            Thank you in advance!

            Comment


              #7
              Hello magnose,

              Welcome to the NinjaTrader forums!

              Below is a link to a forum post with helpful information about getting started with NinjaScript.


              If Kylie does not get back to you, I am happy to answer any questions you have if you decide to create this script.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              571 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              331 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              549 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              550 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X