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

Change color property of an indicator called from strategy

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

    Change color property of an indicator called from strategy

    Hello,
    I have this Color property in an indicator.
    I can change the color when I use the indicator in the chart, but I cant see ir when I add this indicator from an strategy with AddChartIndicator(),
    Why? how could I see and change the indicator property color when I call from and strategy as indicator ?
    Thank you


    Code:
            [Display(Name="myColor", Description="My Color", Order=8, GroupName="Visual")]
            public SolidColorBrush myColor
            { 
                get {return myColorVar;}
                set {myColorVar= value;}
            }

    #2
    Hello ninjo,

    In this case, you cannot see or change this from the UI because the strategy added the indicator.

    You would need to recreate this property in your strategy for it to also show up in the strategy properties. After doing that, you would also need to supply the SolidColorBrush to the indicator when you call it in the strategy.


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

    Comment


      #3
      Hello Jesse, thnak you,

      If I try with other indicator, for example SMA() o EMA() I can change the color of line...

      Comment


        #4
        Its possible to know the color property of a plot object via code?

        Comment


          #5
          Originally posted by ninjo View Post
          Its possible to know the color property of a plot object via code?
          Plots[0].Brush is color of the first plot.

          Comment


            #6
            Hello ninjo,

            Thank you for your reply.

            Yes, this is still possible however this is a different process than your first example. In your first example, the indicator already had a brush input where the SMA does not. As nkhoi noted, you would need to access the properties of the indicator to set its Plot's color.

            Here is a small example using AddChartIndicator, however this concept applies anywhere you create a variable for an indicator like this.
            Code:
            SMA mySma = SMA(12);
            mySma.Plots[0].Brush = Brushes.Plum;
            AddChartIndicator(mySma);
            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rocketman7, Today, 02:12 AM
            0 responses
            5 views
            0 likes
            Last Post rocketman7  
            Started by dustydbayer, Today, 01:59 AM
            0 responses
            1 view
            0 likes
            Last Post dustydbayer  
            Started by inanazsocial, Today, 01:15 AM
            0 responses
            5 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by trilliantrader, 04-18-2024, 08:16 AM
            5 responses
            22 views
            0 likes
            Last Post trilliantrader  
            Started by Davidtowleii, Today, 12:15 AM
            0 responses
            3 views
            0 likes
            Last Post Davidtowleii  
            Working...
            X