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

Dotted Line as default

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

    Dotted Line as default

    Hi,

    How can I code an indicator Line to be dotted by default?

    By default a line's Dashstyle is a solid line, but I'd like to set it to Dot. I can do this with Plot() and Drawline(), but how can I do this with Line()?

    I can change the Line style manually in the indicators window, so there must be a way to set this within the indicator code,

    Thanks,
    Jeremy

    #2
    Try something like this in Initialize() after you call the Add() method for the plot.

    Plots[0].Pen.DashStyle = DashStyle.Dash;
    RayNinjaTrader Customer Service

    Comment


      #3
      dotted lines set as default

      not much luck with getting the dotted lines set up as default
      Attached Files
      Last edited by duck_CA; 01-19-2008, 01:02 PM. Reason: additional pic

      Comment


        #4
        The following code will work:

        Code:
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Initialize()[/SIZE][/FONT]
        [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
        [SIZE=2][FONT=Courier New]    Add([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Plot(Color.Blue, PlotStyle.Line, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"DoubleEMA"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]));[/SIZE][/FONT]
        [SIZE=2][FONT=Courier New]    Plots[[/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]].Pen.DashStyle = DashStyle.Dash;[/SIZE][/FONT]
        [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
        Make sure any NinjaScript changes you make you reload in any already applied indicators that you changed. You can do this via right clicking in chart and selecting the menu "Reload NinjaScript"
        RayNinjaTrader Customer Service

        Comment


          #5
          need the exact way it should look in the script, please

          how can i include the values in the script? example would be: a dotted line @ 14230
          Attached Files

          Comment


            #6
            In order for your code to take effect you will need to first remove the indicator from the chart and readd it. This will then replace the Solid dashstyle setting with your new Dash DashStyle.

            To have an option as to what value you want your line drawn on you will need to create a user definable variable in your code. Please take a look at the SMA indicator to see how we created a user definable input for the Period. Alternatively, since what you want to do seems to be just draw horizontal lines you may want to try using the ConstantLines indicator that we have provided. You can always change the solid line to a dashed line in the right settings when you are adding the indicator.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              dotted lines

              thanks guys but i need the "exact" way of doing as i am no tech guy here
              is there a way i could just "copy" the formula to a new or blank indicator and move forward. i have spent several hours trying to figure this out with no luck and any help would greatly be appreciated. you can look at the pic i posted above which would show a dotted line that allows me to input a number in the script as well.. example would be: a dotted line @ 12450. i will have about 100 of these lines to do so if i could get it set up through the ninja script, it would make my life easier.

              keep up the great works people

              Comment


                #8
                See the attached reference sample.
                Attached Files
                RayNinjaTrader Customer Service

                Comment


                  #9
                  thanks

                  hey ray,
                  thanks for the zip file. works nicely for the 2 examples you created. can you tell me how formula would look for more than 2?

                  i got an error when adding a additional line set thingy. were closer

                  thanks
                  Attached Files

                  Comment


                    #10
                    Unfortunately not, I am already outside the scope of what we provide support for. You will need to open the file and really look at what is happening.

                    Hints -

                    Look in the Properties Region
                    Look in the Variables Region
                    Try to replicate the lines of code and slight change the names etc...
                    RayNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by The_Sec, Today, 02:29 PM
                    1 response
                    4 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    2 responses
                    30 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by Mindset, 05-06-2023, 09:03 PM
                    10 responses
                    265 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by michi08, 10-05-2018, 09:31 AM
                    5 responses
                    743 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by tsantospinto, 04-12-2024, 07:04 PM
                    4 responses
                    63 views
                    0 likes
                    Last Post aligator  
                    Working...
                    X