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 AaronKoRn, Today, 09:49 PM
        0 responses
        6 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Today, 08:42 PM
        0 responses
        9 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Today, 07:51 PM
        0 responses
        10 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,976 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Today, 06:48 PM
        0 responses
        9 views
        0 likes
        Last Post rbeckmann05  
        Working...
        X