MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

ZigZag Validity by Spyros Raftopoulos

This was my first attempt to confront the problem of the dynamic last leg
of the zigzag indicator. Articles of mine about this indicator and the problem of the last leg of the zigzag indicator have been published by the Technical Analysis of Stocks and Commodities (August 2002 issue) and by the Guppy Traders (September 2002 issue).

It returns 1 for valid LAST leg of zig() - regardless of zig's direction - and 0 for revisable (NOT valid) LAST leg. It is NOT a stand-alone indicator, but it has to be used WITH the zigzag indicator. It is useful for visual inspection only. ZigZag Validity's PAST readings are NOT trustworthy. It must NOT be used in systems.

It does NOT say the truth about the past, but it is absolutely RELIABLE about the PRESENT! (Strange but true!)

This indicator returns 1 for valid LAST leg of zig() - regardless of zig's direction - and 0 for revisable (NOT valid) LAST leg. It is NOT a stand-alone indicator, but it has to be used WITH the zigzag indicator. The zig() should calculate close prices and should use the same percent with the ZigZag validity.

You must realize that while zig() is always correct about the past but not reliable about the present, Zigzag Validity is trusty NOW (validating the last leg of zig) but NOT in the past.

This makes both zig() and Zigzag Validity NOT suitable for back tests. Use both indicators for visual inspection only!


ZigZag Validity

{*********** Start of code *************}

{ZigZag validity by Spyros Raftopoulos
It validates the LAST LEG of the Zigzag indicator.
1=valid (not revisable), 0=invalid (revisable).
Do NOT use this indicator in systems.}

perc:=Input("Percent",0.2,100,10);

Z:=Zig(CLOSE,perc,%);
last:=ValueWhen(1,( Z > Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2) )
OR
( Z < Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2) ),
Ref(Z,-1));

pc:=(CLOSE-last) * 100 / last;
pc:= Abs(pc);

SD:=(z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2)) OR (z<Ref(z,-1) AND Ref(z,-
1)<Ref(z,-2));

res:=If(pc>=perc ,1,0);
If(Alert(res,2) AND SD,1,res)

{*********** End of code *************}

 

Contact me for comments or questions at raftsp@otenet.gr

Source / From: TOP
http://purebytes.com/archives/metastock/

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!