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 Waxavi, Today, 02:10 AM
    0 responses
    4 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by TradeForge, Today, 02:09 AM
    0 responses
    10 views
    0 likes
    Last Post TradeForge  
    Started by Waxavi, Today, 02:00 AM
    0 responses
    2 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by elirion, Today, 01:36 AM
    0 responses
    4 views
    0 likes
    Last Post elirion
    by elirion
     
    Started by gentlebenthebear, Today, 01:30 AM
    0 responses
    4 views
    0 likes
    Last Post gentlebenthebear  
    Working...
    X