Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Syntax for Adding DashStyle and Width for plot

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

    Syntax for Adding DashStyle and Width for plot

    Hi Support,

    How do I add DashStyle and Width to a plot in a ninjascript. For example, if I want to add a plot, can it be done like this:

    Add(new Plot(Color.FromKnownColor(KnownColor.Red),DashStle .Dot, PlotStyle.Line, Width.2,"Line" ));

    I want to add it in the ninjascript itself,so that I need not adjust the dash style and width when I load the indicator on a chart.

    Thanks
    Commodity_trader
    Last edited by commodity_trader; 09-04-2008, 09:36 AM.

    #2
    Hi commodity_trader,

    To do this you would do the following:
    Code:
    Add(new Plot(new Pen(Color.Red, 3), PlotStyle.Line, "Line"));
    Plots[0].Pen.DashStyle = DashStyle.Dot;
    The Plots[x] would correspond to whichever plot you wanted DashStyle to be adjusted on.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh, just tried it , it worked.

      If I want to define several plots, with the same Penstyle and width, is it like possible to define the pen style before hand and use it in the plot. How does one define pen style?

      Can I do something like this:
      Add(new Plot(RedPen), PlotStyle.Line, "Line"));

      where in RedPen is already somehow defined as a Pen with color Red width 2, and dash style Dot?

      Thanks
      Commodity_trader

      Comment


        #4
        Code:
        Pen RedPen = new Pen(Color.Red, 2);
        Add(new Plot(RedPen, PlotStyle.Line, "Line"));
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, Today, 10:57 PM
        0 responses
        5 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        158 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Today, 09:29 PM
        0 responses
        7 views
        0 likes
        Last Post Belfortbucks  
        Started by zstheorist, Today, 07:52 PM
        0 responses
        7 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        151 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Working...
        X