NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 01-19-2008, 06:58 AM   #1
jeremymgp
Member
 
Join Date: Aug 2007
Posts: 70
Thanks: 0
Thanked 0 times in 0 posts
Default 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
jeremymgp is offline  
Reply With Quote
Old 01-19-2008, 07:56 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

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

Plots[0].Pen.DashStyle = DashStyle.Dash;
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-19-2008, 11:54 AM   #3
duck_CA
Senior Member
 
Join Date: Jan 2008
Location: sacramento CA
Posts: 181
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Yahoo to duck_CA Send a message via Skype™ to duck_CA
Default dotted lines set as default

not much luck with getting the dotted lines set up as default
Attached Images
File Type: png crunchies with dotted lines2.png (39.7 KB, 14 views)
File Type: png crunchies with dotted lines3.png (34.2 KB, 17 views)
Last edited by duck_CA; 01-19-2008 at 12:02 PM. Reason: additional pic
duck_CA is offline  
Reply With Quote
Old 01-19-2008, 02:21 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

The following code will work:

Code:
protected override void Initialize()
{
    Add(new Plot(Color.Blue, PlotStyle.Line, "DoubleEMA"));
    Plots[0].Pen.DashStyle = DashStyle.Dash;
}
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"
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-19-2008, 02:50 PM   #5
duck_CA
Senior Member
 
Join Date: Jan 2008
Location: sacramento CA
Posts: 181
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Yahoo to duck_CA Send a message via Skype™ to duck_CA
Default 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 Images
File Type: png crunchies with dotted lines4.png (67.4 KB, 17 views)
duck_CA is offline  
Reply With Quote
Old 01-19-2008, 03:03 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

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.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-30-2008, 12:15 AM   #7
duck_CA
Senior Member
 
Join Date: Jan 2008
Location: sacramento CA
Posts: 181
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Yahoo to duck_CA Send a message via Skype™ to duck_CA
Default 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
duck_CA is offline  
Reply With Quote
Old 01-30-2008, 07:31 AM   #8
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

See the attached reference sample.
Attached Files
File Type: zip MyLines.zip (1.6 KB, 13 views)
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-30-2008, 09:24 AM   #9
duck_CA
Senior Member
 
Join Date: Jan 2008
Location: sacramento CA
Posts: 181
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Yahoo to duck_CA Send a message via Skype™ to duck_CA
Default 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 Images
File Type: png ninja forum dotted lines.png (66.7 KB, 20 views)
duck_CA is offline  
Reply With Quote
Old 01-30-2008, 09:33 AM   #10
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

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...
NinjaTrader_Ray is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to draw a parallel line to a trend line? tradewiz Charting 4 12-19-2007 04:42 AM
Default Value for EntryHandling aslane Strategy Development 2 12-03-2007 07:18 AM
Default ATM Strategy vlc Suggestions And Feedback 5 10-01-2007 05:55 AM
Default Time Intervals biggo Charting 4 07-12-2007 12:04 AM
Line "names" in Indicator Box change to "Line" after modification higler Charting 3 05-02-2007 06:05 AM


All times are GMT -6. The time now is 07:46 PM.