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

Access the color property of an indicator in a strategy

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

    Access the color property of an indicator in a strategy

    I have looked around for how to do this, but have been unable to find out how. I have an indicator that I want to use as a filter for a strategy I am building. It is a ma indicator that changes color based on if it is in chop, long bias, or short bias. Is there a way for me to access the color of the plot of a certain bar.
    For example:
    if(indicator()[0] == Color.Blue || indicator()[0] == Color.Green)
    //Place trade
    Any information would be greatly appreciated.

    #2
    Hello laces2,
    Thanks for writing in and I am happy to assist you.

    Yes, you can access the color as long the indicator is plotted on the chart from the initialize section of the strategy (using the Add(MyIndicator() code), and for realtime values only. Please use the below code to do it.

    Code:
    if (MyIndicator().PlotColors[0][1] == Color.Green)
    {
      //do something
    }
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by benmarkal, Yesterday, 12:52 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by helpwanted, Today, 03:06 AM
    1 response
    17 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    11 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    6 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Working...
    X