Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Painting indicators

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

    Painting indicators

    Hi,

    I'm sure it's very easy, but Idon't find solution.
    I want to add 3 EMA in chart where my strategy runs.
    I use:

    Add(EMA(periodo_corto));
    Add(EMA(periodo_medio));
    Add(EMA(periodo_largo));

    How can I have different colors for every EMA?

    Thanks

    #2
    Hello,

    Here is a thread with a code sample of how to do what you ask : http://www.ninjatrader.com/support/f...ad.php?t=48664

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hello Adam_P,
      the example shows, how to get the colorinformatin of an indicatorline. But how can the plotpreferences of an indicator be set, wich was added in initialize()?

      maybe:

      Code:
       
      set.indicator().color = color.cyan;
      set indicator().plotstyle = plotstyle.bar;
      thx Jens

      Comment


        #4
        Thanks AdamP,

        But I don't want to known the color of one indicator. I want to set the color of indicator I'm adding.

        Comment


          #5
          xenayoo,

          You can't set the plot style conditionally on a bar-by-bar basis unfortunately, so there isn't really a supported way to do this. I could suggest adding this feature to our development team if you would like.
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            jjos,

            Please go to Tools > Edit NinjaScript > Strategy > SampleMACrossover. This shows how to set colors in it as well.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Hello Adam_P,

              first I have to say, that jjos69 whant exactly the same thing like me. ;-)

              second: we can format the plots of a dummy-indicator (strategyplot). Why we couldn't change the plotproperties of a real indicator?

              Code:
               
              StrategyPlot(n).Plots[0].Pen.Color = Color.Blue;
              StrategyPlot(n).Plots[0].PlotStyle = PlotStyle.Bar;
              Thx Jens

              Comment


                #8
                xenayoo,

                If you want to change the plot style to something different bar-by-bar its not possible, but if you want to set the plotstyle from your Initialize() section you may be able to do this. Please note that PlotStyle is not accessible from within a Strategy without work arounds.
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  Ok, Here is the answer:

                  You can change the plotproperties of an indicator added in the Initialize()-method of a strategy:

                  in the Initialize-Method:

                  Code:
                   
                  Add(Indicatorname(Input1,....);
                   
                  Indicatorname(Input1,...).Plots[n].Pen.Color = Color.Green;
                  while n is the number of the Plot beginning with 0 if the Indicator have mor than 1 Plot.

                  cheers Jens

                  Comment


                    #10
                    Originally posted by NinjaTrader_AdamP View Post
                    xenayoo,

                    If you want to change the plot style to something different bar-by-bar its not possible, but if you want to set the plotstyle from your Initialize() section you may be able to do this. Please note that PlotStyle is not accessible from within a Strategy without work arounds.
                    Yes, but you can do this in the indicator. My problem was: I want to use the LinRegSlope-Indicator. This is a system-indicator and i cant chenge the default properties. If I reload the strategy, the Indicator was plotted in the default properties of this Indicator....

                    For changing properties Bar by Bar you have to use the workaround with the dummy-indicator. But its more easy, if yo do that in the indicator itself.

                    Jens
                    Last edited by xenayoo; 05-23-2012, 10:42 AM.

                    Comment


                      #11
                      xenayoo,

                      Strategies and indicators are part of totally different namespaces, so they have different structure and accessible methods from an Object-Oriented perspective. I can suggest to development to add the ability to set the PlotStyle from a Strategy if you would like.
                      Adam P.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_AdamP View Post
                        xenayoo,

                        Strategies and indicators are part of totally different namespaces, so they have different structure and accessible methods from an Object-Oriented perspective. I can suggest to development to add the ability to set the PlotStyle from a Strategy if you would like.
                        No need to do that. It works:

                        Code:
                         
                        IndicatorName(Input1,...).Plots[n].PlotStyle = PlotStyle.Bar;
                        Jens

                        Comment


                          #13
                          Originally posted by NinjaTrader_AdamP View Post
                          jjos,

                          Please go to Tools > Edit NinjaScript > Strategy > SampleMACrossover. This shows how to set colors in it as well.
                          Thanks Adamp. This is I'm looking for.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          656 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          371 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          109 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          574 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          579 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X