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 DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        11 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        8 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        7 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Working...
        X