NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 05-20-2010, 10:39 AM   #1
futuros
Member
 
Join Date: May 2010
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default Strategy using ZigZag

hello,

Using the strategy wizard, is it possible to buy (or sell at the top) next bar at market when the zig zag indicator shows the blue line down at the botton of the market? I was trying to get that logic work out using the wizard but I dont really know how.

Anybody tried to code a strategy using the zig zag?

Thanks for any help!

Alan
futuros is offline  
Reply With Quote
Old 05-20-2010, 11:02 AM   #2
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

Hello futuros,

Welcome to the NinjaTrader forums.

Zig zag will return a numeric value and you can make comparisons with ZigZag to price data. Please see the help guide article below, on using the condition builder for indicator to value comparisons.
http://www.ninjatrader-support.com/H...mparisons.html

On the right side of this comparison you could select instead price data.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 05-20-2010, 11:19 AM   #3
futuros
Member
 
Join Date: May 2010
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

Thanks Ryan, If I put a deviation value 0f 3.0 do you have an idea what numeric value will result so Zig Zag will give a buy or sell signal?

Thanks again,
Alan
futuros is offline  
Reply With Quote
Old 05-20-2010, 11:25 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

Not sure what value would result.

You can Save a modified version of this indicator by right clicking > Save As and giving it a new name.

You can then use Print() statement to see the values through the Tools > output window.


Print(
"High Series: " + zigZagHighSeries);
Print(
"Low Series: " + zigZagLowSeries);
NinjaTrader_RyanM is offline  
Reply With Quote
Old 05-20-2010, 11:54 AM   #5
futuros
Member
 
Join Date: May 2010
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

OK Ryan, I got the new indicator ZigZagAlan, where do I put the Print() statement, inside the code? or in the output window?
futuros is offline  
Reply With Quote
Old 05-20-2010, 12:48 PM   #6
futuros
Member
 
Join Date: May 2010
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

Hi Ryan, I got it (put it in the indicator's code) but is giving me the value of the index (sp500) where the ZigZag is changing position (from long to short and viceversa) but is not giving me an indicator value, like the ADX above 20 for example, how do I fix that?

Thanks,
Alan
futuros is offline  
Reply With Quote
Old 05-20-2010, 01:04 PM   #7
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 Futuros,

You're looking at the indicator value. It follows closely with price.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 06-26-2010, 06:32 PM   #8
Stan01
Junior Member
 
Join Date: Jun 2010
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
Default

I am trying to use the zigzag indicator in a strategy with some other indicators and would like to detect when the zigzag is hit(or when the trend line is drawn or trend changes). How would I set it up in the strategy wizard using the indicator.
================================================== =========

I have tried several different ways as suggested in these posts to detect a change in direction using the wizard to create a strategy to signal buy and sell points, Backtesting comes up with 0 trades. Any suggestion will help. I am not a programmer. Thanks!

Stan.
Attached Images
File Type: jpg ZigZag set up.jpg (97.6 KB, 40 views)
Stan01 is offline  
Reply With Quote
Old 06-27-2010, 08:04 AM   #9
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

I am jumping in here, but I will try to assist.

The zigzag redraws and is difficult to use programatically. It is meant only for visual observation. However to see how ZigZag changes dynamically, Print() the values you are using from it and see how they change in live market conditions. That may help.
NinjaTrader_Ben is offline  
Reply With Quote
Old 06-27-2010, 09:32 AM   #10
Stan01
Junior Member
 
Join Date: Jun 2010
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
Default

Hello Ben,

Thanks for your response, I do realise and am aware that zigzag alone cannot be used for buy/sell strategies. Therefore I want to use zigzag as one of the indicators and would help as a confirmation for even a temporary change in direction.

I have used this strategy on an other platform successfully and am trying to port the concept and build it in Ninja Trader using the Wizard.

I would like to see the "trendDir" value and the High/Low Price on the Condition Builder so I can compare values.

Appreciate your guidance.

Stan.
Last edited by Stan01; 06-27-2010 at 11:48 AM.
Stan01 is offline  
Reply With Quote
Old 06-27-2010, 10:38 PM   #11
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

I am sorry, this would need to be programmed in custom as a plot. You only have the low and high available.
NinjaTrader_Ben is offline  
Reply With Quote
Old 06-28-2010, 02:17 AM   #12
Stan01
Junior Member
 
Join Date: Jun 2010
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
Default

And how do you access the low and high that is available.
Stan01 is offline  
Reply With Quote
Old 06-28-2010, 08:08 AM   #13
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

Hello Stan01,

Attached is a screenshot showing how to select Zig Zag from the list of indicators in the condition builder. You can select either the ZigZagHigh or ZigZagLow plot.

See here for the help guide article on selecting individual plots through the condition builder.
Attached Images
File Type: gif zigZagSelect.png (50.3 KB, 52 views)
NinjaTrader_RyanM 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 problem Creamers Indicator Development 5 08-01-2008 02:46 AM
ZigZag on last bar ssierra NinjaScript File Sharing Discussion 3 02-02-2008 01:33 AM
ZigZag with labels dkelly NinjaScript File Sharing Discussion 3 01-25-2008 11:03 AM
ZigZag not visible JonesWooHoo Charting 2 10-08-2007 05:42 PM


All times are GMT -6. The time now is 10:19 PM.