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 FrancisMorro, Today, 03:24 AM
        0 responses
        1 view
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,769 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        30 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        943 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        10 views
        0 likes
        Last Post Max238
        by Max238
         
        Working...
        X