• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 vpzdcv, Today, 02:31 AM
        0 responses
        7 views
        0 likes
        Last Post vpzdcv
        by vpzdcv
         
        Started by YevhenShynkarenko, Today, 01:22 AM
        0 responses
        13 views
        0 likes
        Last Post YevhenShynkarenko  
        Started by ttodua, Today, 12:52 AM
        0 responses
        6 views
        0 likes
        Last Post ttodua
        by ttodua
         
        Started by ttodua, Today, 12:50 AM
        0 responses
        5 views
        0 likes
        Last Post ttodua
        by ttodua
         
        Started by mulshah, Yesterday, 11:12 PM
        0 responses
        6 views
        0 likes
        Last Post mulshah
        by mulshah
         
        Working...
        X