Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Plot Color for an Indicator in a Strategy

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

    Strategy Plot Color for an Indicator in a Strategy

    I have a strategy which adds a few indicators onto the chart when the strategy is loaded and enabled. I was able to direct the panel which the plot was directed to with the following commands in the Initialize section of the strategy:

    SceetoCLMacDaddy(true).Panel=1;
    Add( SceetoCLMacDaddy(true));

    The first line directs the named plot to a specific panel and the second line actually adds the
    indicator to the chart.

    My question is, is there a similar syntax for directing both the color of the particular indicator and the line type, in a manner similar to directing the plot panel. I've tried various combinations and none have worked so far. I know it is possible to manually change the color and type once it is on the chart but I'd like it to be correct as soon as it is added.

    If that is possible.

    Thanks

    DaveN

    #2
    Hello DaveN,
    Thanks for your post.

    Yes, you can do so. Please refer to the SampleMACrossover strategy that comes with NinjaTrader which further demonstrates how to color the plots.


    Code:
    SMA(Fast).Plots[0].Pen.Color = Color.Orange;
    SMA(Slow).Plots[0].Pen.Color = Color.Green;


    You can set the DashStyle via the Pen class itself.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I'm sorry to be thick but when I search the help guiide I find no pen class. There is a plot class but I tried setting the style as I did the color and it doesn't work. The color setting works fine using the following command:

      EMA(Close, 3).Plots[5}.Pen.Color = Color.Magenta;

      but when I try the following:

      EMA(Close, 3).Plots[5].Pen.PlotStyle = PlotStyle.Dot;

      I get an error message referring me to CS1061, but when I look that up on the MSN error codes it doesn't appear to exist. What is the syntax I should be using to set the pen plotstyle to dots?

      Thanks
      DaveN

      Comment


        #4
        Hello DaveN,
        The Pen class is not documented in our help guide.You can find more information from here
        http://msdn.microsoft.com/en-us/libr...awing.pen.aspx

        If you try using the below code then are you able to get it work
        Code:
        EMA(3).Plots[0].Pen.DashStyle = DashStyle.Dot;
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Originally posted by daven View Post
          I'm sorry to be thick but when I search the help guiide I find no pen class. There is a plot class but I tried setting the style as I did the color and it doesn't work. The color setting works fine using the following command:

          EMA(Close, 3).Plots[5}.Pen.Color = Color.Magenta;

          but when I try the following:

          EMA(Close, 3).Plots[5].Pen.PlotStyle = PlotStyle.Dot;

          I get an error message referring me to CS1061, but when I look that up on the MSN error codes it doesn't appear to exist. What is the syntax I should be using to set the pen plotstyle to dots?

          Thanks
          DaveN
          Pen does not have a PlotStyle. Try DashStyle instead. You must use defined properties if you want to modify objects.

          Comment


            #6
            Thanks, I have it working now and it is making the indicator colored dotted lines. I appreciate the help.
            DaveN

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Don22Trader1, Yesterday, 04:20 PM
            1 response
            20 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by ginx10k, Today, 05:49 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Goldy, Today, 04:00 AM
            0 responses
            15 views
            0 likes
            Last Post Goldy
            by Goldy
             
            Started by Betican, Today, 12:32 AM
            0 responses
            19 views
            0 likes
            Last Post Betican
            by Betican
             
            Started by Betican, Today, 12:25 AM
            0 responses
            18 views
            0 likes
            Last Post Betican
            by Betican
             
            Working...
            X