Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

reading bar colors?

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

    reading bar colors?

    Hi,

    Is it possible to "read" the bar color within a strategy when that color is generated by an indicator? So for example:

    if(barcolor == green){do something, like trigger a trade...}

    In my psuedo-code above the bar would be painted a green color from a seperate indicator unrelated to the strategy...thanks for any info.

    Regards

    #2
    Sure, just check the property BarColor.

    RayNinjaTrader Customer Service

    Comment


      #3
      Thank you Ray, however it doesn't seem to work correctly...my code is below. It compiles without problems but no "Cyan dots" appear below the bars as they should, unless of course my code is wrong...

      if(BarColor == Color.Blue)
      {
      MISC2 = Low[0] - (40 * TickSize);
      DrawDot("stop" + Time[0], 0, MISC2, Color.Cyan);
      }


      thanks again.

      Comment


        #4
        Debug...

        Print(BarColor.ToString());

        etc...
        RayNinjaTrader Customer Service

        Comment


          #5
          Hello,

          Is this a valid statement?:

          "if(BarColor == Color.Blue)"

          That is the reason I posted my code. The Print statement debug just informs me "Color [empty]" in the Output Window despite the fact that it should not be...thanks for any help.

          Comment


            #6
            Yes this is a valid statement however, my suggestion was incorrect. BarColor only holds the color that you custom set. At this time, there is no supported way to get the color of the bar.
            RayNinjaTrader Customer Service

            Comment


              #7
              Wow, that seems a bit hard to believe...but thank you for the response, oh well....

              Comment


                #8
                How about if I have HMA that changes color Blue going up and red going down.

                Is it possible to auto trade on the change of the indicator color? Not based on the bar color.


                Thanks, Al

                Comment


                  #9
                  garciaal,

                  Yes you can. BarColor will return Color [Empty] unless somewhere in your code you set BarColor to equal something. If its been set to equal something it will return whatever you set it to. It just cannot be used to get the default colors of the normal untampered bars. (But you can still easily side step this by just checking Close vs Open prices)
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    reading bar color or values of another indicator on chart?

                    Hi,

                    I would like to read the current bar color OR the current value of plot(s) from the Indicator in Panel 2... How can I do this?

                    Thanks

                    Comment


                      #11
                      Unfortunately this is not supported. We have reading the bar color on our list of NT7 improvements yet.

                      I'll add reading other indicator plots to our list of future considerations. Thanks for your suggestion.

                      Comment


                        #12
                        just to clarify... it is not possible read values either of other plotted indicators?

                        I'm pretty sure that's what you wrote, but just double checking.

                        Comment


                          #13
                          >> it is not possible read values ... of other plotted indicators?
                          correct

                          Comment


                            #14
                            Originally posted by NinjaTrader_Dierk View Post
                            >> it is not possible read values ... of other plotted indicators?
                            correct
                            If I understand correctly, I can not find out the RSI (for example) value of the last three (for example) bars?

                            If this is correct, is there an easy way to side step this?

                            Thanks

                            Comment


                              #15
                              you can do that, look in ninja help... they have lots of functions that do what the built-in indicators do... no need to actually have an RSI indicator plotted.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              633 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              364 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              566 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              568 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X