Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

AddPlot() direct syntax for adding DashStyle PlotStyle and Width for plot

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

    AddPlot() direct syntax for adding DashStyle PlotStyle and Width for plot

    Hello

    Going to the Help Guide:


    I can't find an 'AddPlot()' syntax example to specify 'DashStyle', 'PlotStyle', and 'Width' for a plot, direclty in single code line. I mean something like:
    Code:
    AddPlot(Brushes.Green, DashStyle.Solid, PlotStyle.Line, Width.2, "LineName");
    I tried with something like the that example but NinjaScript give errors and I only find simplified examples like:
    Code:
    AddPlot(Brushes.Green, "LineName");
    In this case one of the most important part for what I need is to be able to specify the Width.


    Finally, in the guide there is also a way for "Dynamically change the primary plot's color based on the indicator value" etc. but what I need in this case is a plot with fixed and static settings that I don't need to go to the script settings or loading templates every time I need to use the script.

    Thank you

    #2
    Originally posted by futurenow View Post

    Going to the Help Guide:
    https://ninjatrader.com/support/help...ml?addplot.htm

    I can't find an 'AddPlot()' syntax example to specify 'DashStyle', 'PlotStyle', and 'Width' for a plot, direclty in single code line. I mean something like:
    Code:
    AddPlot(Brushes.Green, DashStyle.Solid, PlotStyle.Line, Width.2, "LineName");
    Today I found the solution for what asked, and it is the next line of code:

    Code:
    AddPlot(new Gui.Stroke (Brushes.Green, Gui.DashStyleHelper.Solid, 2), PlotStyle.Line,"LineName");

    It would be useful if the guide (https://ninjatrader.com/support/help...ml?addplot.htm) would have an example like this to cover these kind of situations.


    Thank you
    Last edited by futurenow; 11-07-2021, 04:51 PM.

    Comment


      #3
      Hello futurenow,

      The help guide specifies a Stroke object is a parameter for AddPlot().
      AddPlot(Stroke stroke, PlotStyle plotStyle, string name)

      The link to the Stroke class specifies the parameters for stroke.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_ChelseaB View Post

        The help guide specifies a Stroke object is a parameter for AddPlot().
        AddPlot(Stroke stroke, PlotStyle plotStyle, string name)

        The link to the Stroke class specifies the parameters for stroke.
        https://ninjatrader.com/support/help...roke_class.htm

        Thank you for your reply Chelsea,

        I meant to say an example in one single line just like the one I posted, to cover the cases when you need to specify the plot settings in a static way and in a simple line, and in the guide I couldn't find an example just like simply:

        AddPlot(new Gui.Stroke (Brushes.Green, Gui.DashStyleHelper.Solid, 2), PlotStyle.Line,"LineName");


        That's all what I meant because it could be a help for others.


        Thank you for your time and have a good day!

        Comment


          #5
          Hello futurenow,

          I will forward your suggestions.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PaulMohn, Today, 05:00 AM
          0 responses
          7 views
          0 likes
          Last Post PaulMohn  
          Started by ZenCortexAuCost, Today, 04:24 AM
          0 responses
          6 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by ZenCortexAuCost, Today, 04:22 AM
          0 responses
          3 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by SantoshXX, Today, 03:09 AM
          0 responses
          16 views
          0 likes
          Last Post SantoshXX  
          Started by DanielTynera, Today, 01:14 AM
          0 responses
          5 views
          0 likes
          Last Post DanielTynera  
          Working...
          X