| || |
Zig-Zag Indicator like in TradeStation ?
I am looking for a Zig-Zag indicator like the one provided with TradeStation 2, which has three input parameters of depth, deviation and backstep.
Has anyone written this or is it available in the ST library?
Depth seems equivalent to the "retracepips" in the ST version. But what do depth and deviation do? I changed them in MarketScope version, and nothing seemed to change?
Originally Posted by mstreck
By the way, I have a version of ZigZag which uses Average True Range to dynamically set the "retracepips" which works quite well.
would you be willing to share this indicator?
I've just posted it up on my webpage. Take a look here.
Originally Posted by mstreck
There's ZigZagPips which is basically a re-write of the existing ZigZagPoints, but with (I think) clearer coding, so it is easier to understand. And ZigZagATR is the one using the ATR (if you do a "difference" check you will see there is not much difference). Both of these use a utility class called MyPoints which is in the _Utils module, which you can also find on my website.
Last edited by robocod; 12-29-2011 at 09:05 PM.
Very nice, thank you robocod.
Your implementation adds much value in terms of using OO techniques, which still need to embrace more, so for me personally very useful.
I think the zig zag versions may look maybe more or less the same depending on the parameter choices, but the TradeStation version differs as it defines the number of bars which local extremes have to be distant to each other by the depth parameter. The other two only have a minor impact on where to exactly put the swing point index-wise.
Below is an explanation I found useful from another forum:
I may code this one up since it is the one I am really looking for to be used for my next strategy project, I need the swing point levels and the time indices.
ZigZag looks at history in Depth size bites and finds the extreme hi and low for those sections. So depth is number of bars you can expect a local extreme to be isolated by.
Backstep is only how far back it will look to allow Deviation to slide the exteme. For example if the low was 1.2000 backstep bars ago, and the deviation is 5 and the current bar closes with a low of 1.2003, then the zig zag low for this region will be marked on the more recent bar, with the older (lower) value. It just allows the near bars to be the same for zig zags purposes, marking it more recently but keeping the actual low. So backstep is just how much slop is allowed in near bar extremes and deviation is how little difference it takes to slop them together. I think of them as 'squelch' type values. I don't think they're as critical to understanding zig zag.
Saying this first part one more time, Depth is how wide a look is made for local extremes.
Zig Zag then goes through and compares those local extremes in a way to find the real extremes. If there was a recent low, it sees if the next extreme is lower (new recent low candidate) or higher (locking in old low, and now looking for extemest high). This results in the zig zag pattern.
The last time through is just a way to get the value for zig zag to be consistent (takes both values and sets them to the zig zag point, whether hi or lo, mostly housekeeping step, not worth worrying about).
Find local extremes. Choose which of these are the real extremes. That's zigzag. Depth determins how 'local' those local extremes are.
Lesser inputs Deviation determines how close to the extreme is 'close enough' to count a bar as being the same local extreme, and backstep determines how recent such a 'close enough' bar must be to be counted that way.
Disclaimer: Trading foreign exchange on margin carries a high level of risk and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. The possibility exists that you could sustain a loss in excess to your investment and therefore you should not invest money that you cannot afford to lose. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. You should be aware of all the risks associated with foreign exchange trading and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. FXCM will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.