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 ラリー, 09-07-2022, 11:54 PM
    16 responses
    112 views
    0 likes
    Last Post ラリー  
    Started by Skechers, Today, 01:40 PM
    1 response
    2 views
    0 likes
    Last Post NinjaTrader_Emily  
    Started by Amitkumar, Today, 01:54 PM
    0 responses
    2 views
    0 likes
    Last Post Amitkumar  
    Started by gemify, 09-30-2021, 10:59 PM
    71 responses
    4,358 views
    6 likes
    Last Post trymph
    by trymph
     
    Started by Skechers, Today, 12:31 PM
    2 responses
    16 views
    0 likes
    Last Post Skechers  
    Working...
    X