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 love2code2trade, Yesterday, 01:45 PM
    4 responses
    28 views
    0 likes
    Last Post love2code2trade  
    Started by funk10101, Today, 09:43 PM
    0 responses
    7 views
    0 likes
    Last Post funk10101  
    Started by pkefal, 04-11-2024, 07:39 AM
    11 responses
    37 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Yesterday, 08:51 AM
    8 responses
    44 views
    0 likes
    Last Post bill2023  
    Started by yertle, Today, 08:38 AM
    6 responses
    26 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Working...
    X