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

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

    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 :

        BertrandNinjaTrader Customer Service

        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 bmartz, 03-12-2024, 06:12 AM
              2 responses
              19 views
              0 likes
              Last Post bmartz
              by bmartz
               
              Started by funk10101, Today, 12:02 AM
              0 responses
              3 views
              0 likes
              Last Post funk10101  
              Started by gravdigaz6, Yesterday, 11:40 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by MarianApalaghiei, Yesterday, 10:49 PM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by XXtrader, Yesterday, 11:30 PM
              0 responses
              4 views
              0 likes
              Last Post XXtrader  
              Working...
              X