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 newton1, Yesterday, 09:54 AM
            2 responses
            61 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by SuperDude123, Yesterday, 08:31 AM
            3 responses
            100 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by jeliner, Yesterday, 12:58 AM
            1 response
            32 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by ezrollin, Yesterday, 12:29 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by peregrine, Today, 05:49 PM
            0 responses
            13 views
            0 likes
            Last Post peregrine  
            Working...
            X