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 knighty6508, 05-10-2024, 01:20 AM
        4 responses
        24 views
        0 likes
        Last Post knighty6508  
        Started by OllieFeraher, 05-09-2024, 11:14 AM
        6 responses
        19 views
        0 likes
        Last Post OllieFeraher  
        Started by PaulMohn, 05-02-2024, 06:59 PM
        2 responses
        43 views
        0 likes
        Last Post PaulMohn  
        Started by ETFVoyageur, Today, 02:10 AM
        0 responses
        11 views
        0 likes
        Last Post ETFVoyageur  
        Started by rayyyu12, Today, 12:47 AM
        0 responses
        8 views
        0 likes
        Last Post rayyyu12  
        Working...
        X