Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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
Can you help answer these questions from other members on NexusFi?
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.
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.
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.
gbPriceActionSwing Ver 1.1, TraderGB, March 23, 2021
This is a modified version of PriceActionSwing indicator that includes the Keltner Minor Trend Rule.
The minor trend turns:
(1) UP when price moves above its most recent high and stays UP until …
gbZigZagFibExtRet, Ver 1.2, TraderGB, March 21, 2021 [Important Update Ver 1.2...see updates below]
Description:
This is a modification of the ZigZagUTG script that shows Fibonacci retracement and/or extension percentages. The indicator allows …
I am looking for a way to have the zig zag indicator show me the VALUE (size in points or ticks) of each move it draws. That should be doable somehow, shouldn´t it? I cannot seem to find a way to do it though. Can you help?