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

Bar Color Question

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

    Bar Color Question

    Hi support,

    A simple question; how would I retrieve the bar color of a historical bar, let's say I wanted to get the color from a bar that is 4 bars ago.

    Thanks!

    #2
    Hello,

    thank you for the question.

    There is not really any supported method to do this but you can do the following, please pay close attention to the details below as this will only work in one situation.

    You are able to check this if you have set the color from the script that you are checking from. This means that if the color was set by indicatorA and you are checking the color from indicatorB this will not work. Both the color and check need to occur in a single indicator. if another indicator sets the color it will report Color.Empty otherwise if this indicator also had set the color it will say the color name:

    Code:
    Print(BarColorSeries[5].ToString());
    Rather than assigning a color as you normally would, you can call BarColorSeries[barsAgo] to get the color of X bars ago.

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

    Comment


      #3
      Jesse, Thank you for the info, it was informative.

      The only question left then is would I be able to invoke indicatorA (using your example) from indicatorB to access the color?

      Thanks

      Comment


        #4
        Hello,

        No unfortunately NinjaScript is designed with single instance in mind meaning that ScriptA has no access to ScriptB when they are both added to the same chart.

        In this case the only way this can work would be if the change color code and the check are in the same indicator.

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Today, 06:40 PM
        0 responses
        2 views
        0 likes
        Last Post algospoke  
        Started by maybeimnotrader, Today, 05:46 PM
        0 responses
        6 views
        0 likes
        Last Post maybeimnotrader  
        Started by quantismo, Today, 05:13 PM
        0 responses
        6 views
        0 likes
        Last Post quantismo  
        Started by AttiM, 02-14-2024, 05:20 PM
        8 responses
        167 views
        0 likes
        Last Post jeronymite  
        Started by cre8able, Today, 04:22 PM
        0 responses
        8 views
        0 likes
        Last Post cre8able  
        Working...
        X