Improve current ZigZag indicator in NT8 - futures io
futures io



Improve current ZigZag indicator in NT8


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 1 posts (4 thanks)
    2. looks_two hedgeplay with 1 posts (0 thanks)
    3. looks_3 trendisyourfriend with 1 posts (0 thanks)
    4. looks_4 sinpeople with 1 posts (0 thanks)
    1. trending_up 1,530 views
    2. thumb_up 4 thanks given
    3. group 6 followers
    1. forum 3 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Improve current ZigZag indicator in NT8

(login for full post details)
  #1 (permalink)
 sinpeople 
Singapore
 
Experience: Beginner
Platform: TDAmeritrade
Trading: Options On Futures
 
Posts: 42 since Aug 2017
Thanks: 4 given, 10 received

Hi folks,

I am looking for an improved version of ZigZag.

The ZigZag, which comes with NT8, only calculates ZigZag points 1 bar ago. I need the following improvements.
1) Eager to update ZigZag points of new high to current bar, if the zigzag trend is up and current bar is at least 1 tick above the last zigzag high. Or update zigzag point of new low to current bar, if the zigzag trend is down and current bar is at least 1 tick below last zigzag low.
2) Lazy to add new zigzag low point after a zigzag uptrend is identified. New zigzag low point is only added after N consecutive bars are below last high, and the difference is larger than a predefined threshold. (if it's still within the threshold after N bars, wait further until it moves higher to update the last zigzag high, or wait it moves down to hit the threshold to add a zigzag low point). Lazy to add new zigzag high point, after a zigzag down trend is identified, is an opposite but similar case.

I believe these 2 improvements will filter out most of those noises at zigzag turning point.

But I have just setup visual studio to put break points in NinjaScripts. There are still quite a lot for me to learn to make the above improvements. Anyone can help me?

Thank you.

Best Regards
David WANG

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Eurex Denali vs dxFeed
Sierra Chart
uptick/downtick vs bid/ask
NinjaTrader
Webinar: Happy Hour w/Cem Karsan
The Elite Circle
Experience with AGN (Introducing Broker)
Brokers
MacdBB V402 NT804 + gradient + pullback not working on N …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
How quickly do algos go bad?
26 thanks
Question about intraday margins
24 thanks
Want your NinjaTrader indicator created, free?
18 thanks
Webinar: Building a System for Trading Psychology w/Jare …
18 thanks
Wyckoff room
12 thanks
 
(login for full post details)
  #2 (permalink)
 trendisyourfriend 
Legendary Market Wizard
Quebec
 
Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker: AMP/CQG
Trading: ES, NQ, YM
 
trendisyourfriend's Avatar
 
Posts: 4,089 since Oct 2009
Thanks: 3,752 given, 5,294 received

A much easier way to filter some of the noise for a zig zag indicator is to display a new swing pivot (High or Low) when price closes above or below the previous bar high/low. This would prevent a swing pivot to form when a group of bars drift higher or lower without closing above or below the previous bar.

Reply With Quote
 
(login for full post details)
  #3 (permalink)
 Fat Tails 
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,858 since Mar 2010
Thanks: 4,238 given, 26,770 received



sinpeople View Post
Hi folks,

I am looking for an improved version of ZigZag.

The ZigZag, which comes with NT8, only calculates ZigZag points 1 bar ago. I need the following improvements.
1) Eager to update ZigZag points of new high to current bar, if the zigzag trend is up and current bar is at least 1 tick above the last zigzag high. Or update zigzag point of new low to current bar, if the zigzag trend is down and current bar is at least 1 tick below last zigzag low.
2) Lazy to add new zigzag low point after a zigzag uptrend is identified. New zigzag low point is only added after N consecutive bars are below last high, and the difference is larger than a predefined threshold. (if it's still within the threshold after N bars, wait further until it moves higher to update the last zigzag high, or wait it moves down to hit the threshold to add a zigzag low point). Lazy to add new zigzag high point, after a zigzag down trend is identified, is an opposite but similar case.

I believe these 2 improvements will filter out most of those noises at zigzag turning point.

But I have just setup visual studio to put break points in NinjaScripts. There are still quite a lot for me to learn to make the above improvements. Anyone can help me?

Thank you.

Best Regards
David WANG


Hi David,

There are at least three necessary improvements for any zigzag indicator:

1. select minimum deviation based on volatility (average range or average true range), this is required for portfolio backtests
2. use both horizontal and vertical condition (swing strength and minimum deviation) for determining swing highs and lows
3. allow for determining swing highs and lows based on high/low or bar closes


Minimum deviation

The minimum deviation is the amount by which price needs to retrace from the current swing high or low, before a new swing leg is added in the opposite direction. The zig zag that ships with NinjaTrader only allows for setting the minimum deviation in points or percent. In case that you wish to run strategy backtests over different instruments, any mnimum deviation set in points and percent cannot be compared over different instruments and you will not be able to run a portfolio backtest for any strategy using the zigzag indicator. In order to let the strategy run on different instruments and obtain comparable values, you would need to measure the minimum deviation against bar volatility. This can best be achieved by setting the minimum deviation in multiples of the average range (AR) or average true range (ATR).

Horizontal and vertical condition for determining swing points

NinjaTrader ships with two different indicators, the Swing indicator and the ZigZag indicator. It is important to understand that both indicators are repainting indicators. A new swing high or low cannot be identified immediately, but you need to wait until the required conditions have been met. Once this is the case the swing high or low will be identified with hindsight knowledge.

- the Swing indicator draws the line from the swing high or low after N bars, where N is the selected swing strength
- the Zigzag indicator draws a preliminary swing high or low, which is not yet final, as the current swing leg may always be extended

Actually, for the Swing indicator, when you set the swing strength to 5 bars, it is required that the high point of the swing high bar be higher than the 5 prececing highs and the 5 following highs. This explains that you need to wait for 5 bars, before a swing high can be identified. Likewise, for the Zigzag indicator, you need to wait that the minimum deviation is exceeded, before a preliminary high becomes a final high when a down leg is added to it. In the first case the delay is determined by the horizontal lag (5 bars) whereas in the second case the delay is due to a vertical lag (minimum deviation).
It is possible to combine the two approaches to build a zigzag that takes into account both conditions, for example that a new leg is added when both a minimum deviation of 2.5 ATRs has been exceeded and when the new high or low point has taken out the 5 prior highs or lows, when the swing strength is set to 5. When combining the two approaches, you may not want to apply the right side of the swing strenght condition, but may only check the N prior bars for higher highs or lows and then draw a new confirmed swing point when the minimum deviation has been reached.

Zigzag based on highs and lows or closes

The zigzag can be built from highs and lows or just from the bar closes. Obviously, when it is built from highs and lows, the swing legs should update intra-bar.
Only when the zigzag is built from the closes, you need to wait until the actual bar close before extending the current swing leg, adding a new leg in the opposite direction or doing nothing.

It is quite difficult to work with Zigzag indicators because of their repainting properties. The last leg is only a preliminary leg, while the second but the last leg is alreadyfrozen.
The same applies to the last swing point, as the current leg may further be extended. The last swing point only becomes a final swing high or low, once a new swing leg has been added in the opposite direction.



NQ 06-21 (5 Minute) 2021_05_03 (11_48_35)

Reply With Quote
The following 4 users say Thank You to Fat Tails for this post:
 
(login for full post details)
  #4 (permalink)
 hedgeplay 
Austin Texas / US
 
Experience: Intermediate
 
Posts: 78 since Dec 2019
Thanks: 77 given, 63 received

FatTails that is a great post.


Just to expand the conversation a little further these two recent good postings byTraderGB possibly offer additional ways of looking at improving the classic ZigZag/Swing indicators.

HedgePlay






Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Improve current ZigZag indicator in NT8


Last Updated on May 13, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

Futures.io Happy Hour with Cem Karsan w/Cem Karsan

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts