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 11-24-2010, 12:12 PM   #1
GreenTrade
Member
 
Join Date: Jan 2008
Posts: 97
Thanks: 0
Thanked 1 time in 1 post
Default ZigZag Help

Will someone explain to me when a new zigzag high or low is actually formed? Is it after a certain number of bars? If my thinking is way wrong will someone just explain the actual technical ways it is calculated and plotted. Thanks!

GT
GreenTrade is offline  
Reply With Quote
Old 11-24-2010, 01:18 PM   #2
NinjaTrader_Tim
NinjaTrader Customer Service
 
NinjaTrader_Tim's Avatar
 
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
Default

Hi GreenTrade,

You can view the code for the ZigZag at "Tools>Edit NS>ZigZag"

Also, here is the description: The ZigZag indicator shows trend lines filtering out changes below a defined level.

Hopefully there are others that would like to give their input.
NinjaTrader_Tim is offline  
Reply With Quote
Old 05-22-2011, 08:29 PM   #3
tacticaltrader
Junior Member
 
Join Date: Feb 2011
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default Current Deviation Value

Hi,

I want to display the deviation value above/below each bar.. Also want to display this value as the currentbar is forming..

I'm new to this language so strangling to work out what is the name of the value is.
I know that you have to set a reference deviation value so that when it is breached a
blue line is plotted.

And where in the code it is found?

I want to use the DrawText object.

example..
DrawText("DeviationTag", currentdeviationValue, 0, 20,Color.Blue)

The reason I want to do this is for learning pruposes..want to see exactly what is happening.

There must be a Dynamic Deviation value as well as a value that is stored when the
reference Deviation Value is breached.


Cheers
Bruce
tacticaltrader is offline  
Reply With Quote
Old 05-23-2011, 08:45 AM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi Bruce,

Thanks for the post and welcome to the NinjaTrader forums!

This page can help you with some code drawing tips.

One thing you'll want to do is add + CurrentBar to the tag to allow uniquely tagged drawing objects. You also might want to base the Y position on bar objects, like highs or lows.
DrawText("DeviationTag" + CurrentBar, currentdeviationValue, 0, High[0],Color.Blue);

An example of using StdDev is available here:
http://www.ninjatrader.com/support/h...ion_stddev.htm
NinjaTrader_RyanM is offline  
Reply With Quote
Old 05-23-2011, 05:59 PM   #5
tacticaltrader
Junior Member
 
Join Date: Feb 2011
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default

ok thanks for the info..

Can anybody tell me if I want to display the current deviation value..what is the name of the string or INT?

As far as I can see the user inputs a reference value named 'Deviation Value'...this may be say 0.08 if using percentages as type.. The program obviuosly works out the current deviation value as
each candle(bar) is forming. Once this 0.08 value is exceeded a blue line is drawn. So just need the name of the string of INT variable so I can print to screen.

Thanks
Bruce
tacticaltrader is offline  
Reply With Quote
Old 05-24-2011, 08:43 AM   #6
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

You can edit the ZigZag source code if you want to see more info on how internal variables are defined. DeviationValue in this indicator is an input, so the value is only what a user types in when applying.

[Description("Deviation in percent or points regarding on the deviation type")]
[GridCategory("Parameters")]
[Gui.Design.DisplayName("Deviation value")]
public double DeviationValue
{
get { return deviationValue; }
set { deviationValue = Math.Max(0.0, value); }
}
NinjaTrader_RyanM is offline  
Reply With Quote
Old 05-26-2011, 06:17 PM   #7
tacticaltrader
Junior Member
 
Join Date: Feb 2011
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default Editing Ninja Indicator

Hi Ryan,

Thanks for your help..

I've worked out the deviation Values location..

Have another question on how we can save and edited script.

EG ZigZag.

If I use the NInja editor and copy and paste code from the ZIGZAG indicator to a new indicator say named ZZ2 when I click save it looks like it saves it in the ninja folders as @ZZ2.cs where I can also see the @ZigZag.cs indicator but when I want to add my new ZZ2 to a chart the ZZ2 indicator is not listed.

Is there something else I need to do?

Cheers
Bruce
tacticaltrader is offline  
Reply With Quote
Old 05-27-2011, 05:42 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Bruce, you would not only want to save your code, but press F5 in the editor to compile it into the custom assembly used to run your code at runtime, after this step your indicator should become selectable from the chart.
NinjaTrader_Bertrand 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
zigzag mullum Automated Trading 10 06-17-2011 12:12 AM
zigzag utc magsab Indicator Development 3 06-17-2010 01:41 PM
ZigZag Values clfield General Programming 4 12-02-2008 11:48 AM
zigzag problem Creamers Indicator Development 5 08-01-2008 02:46 AM
ZigZag not visible JonesWooHoo Charting 2 10-08-2007 05:42 PM


All times are GMT -6. The time now is 11:47 PM.