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

How do you get the bar color?

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

    How do you get the bar color?

    In an indicator, how do you retrieve the bar color? I do not want the "check for conditions" solution.. The indicator I am writing is checking for when another indicator paints the bar, so the check for this/that condition is not an option.

    #2
    Hello,

    Thank you for the question.

    The BarColor property will report as Color.Empty unless the script sets a value for that bar.

    The solution is to check the same condition as the other indicator in which paints the bars originally to duplicate the same logic.

    Unfortunately unless the other script explicitly exposes a signal or Color series, there is no way around this as the BarColor is only visible for the script that sets it. An example would be:

    Indicator 1 sets BarColor to Color.Red for ALL bars.
    Indicator 2 Reads BarColor, but it reports as Empty for ALL bars.

    This would be expected that each indicator has an empty bar color collection in which it can control the color of each bar.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      What about for just the default bars on the chart? The ones that haven't been modified by an indicator.

      Comment


        #4
        Hello,

        These colors are also not accessible in the way you would like.

        You could access the Property that you set and get the Up or Down color for the base colors, but there would be no way to know which bars are each color.

        The Bars are colored with these colors based on the conditions of the ChartStyle being used. After this, if an Indicator has a conditions that additionally change the BarColor, these colors would be used for X bar instead of the base series color. The best solution would be if the indicator that is coloring the bars exposes a signal or color series. From that a strategy could tell what each bar color was

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Kaledus, Today, 01:29 PM
        0 responses
        3 views
        0 likes
        Last Post Kaledus
        by Kaledus
         
        Started by PaulMohn, Today, 12:36 PM
        1 response
        16 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by yertle, Yesterday, 08:38 AM
        8 responses
        37 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by rdtdale, Today, 01:02 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        3 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X