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 #

Safe Pivots
Here's the MS code for the MarketWarrior Strategy "Safe Pivots" discussed here http://www.marketwarrior.com/public/1/strategy1.htm Not bad, at times, tends to be fairly conservative & misses extreme trends but works ok when looking for an entry into the early phase of an established trend with pullbacks

Safe Pivots


Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
xH:=If(Dw=1,
{then}(Ref(HighestSince(1,Dw=1,H),-1)),0);

mawH:=
(ValueWhen(1,xh>0,xh)+
ValueWhen(2,xh>0,xh)+
ValueWhen(3,xh>0,xh)+
ValueWhen(4,xh>0,xh)+
ValueWhen(5,xh>0,xh)+
ValueWhen(6,xh>0,xh)+
ValueWhen(7,xh>0,xh)+
ValueWhen(8,xh>0,xh)+
ValueWhen(9,xh>0,xh)+
ValueWhen(10,xh>0,xh)+
ValueWhen(11,xh>0,xh)+
ValueWhen(12,xh>0,xh)+
ValueWhen(13,xh>0,xh)+
ValueWhen(14,xh>0,xh)+
ValueWhen(15,xh>0,xh)+
ValueWhen(16,xh>0,xh)+
ValueWhen(17,xh>0,xh))/17;

xL:=If(Dw=1,
{then}(Ref(LowestSince(1,Dw=1,L),-1)),0);

mawL:=(ValueWhen(1,xl>0,xl)+
ValueWhen(2,xl>0,xl)+
ValueWhen(3,xl>0,xl)+
ValueWhen(4,xl>0,xl)+
ValueWhen(5,xl>0,xl)+
ValueWhen(6,xl>0,xl)+
ValueWhen(7,xl>0,xl)+
ValueWhen(8,xl>0,xl)+
ValueWhen(9,xl>0,xl)+
ValueWhen(10,xl>0,xl)+
ValueWhen(11,xl>0,xl)+
ValueWhen(12,xl>0,xl)+
ValueWhen(13,xl>0,xl)+
ValueWhen(14,xl>0,xl)+
ValueWhen(15,xl>0,xl)+
ValueWhen(16,xl>0,xl)+
ValueWhen(17,xl>0,xl))/17;

madP:=Mov(MP(),17,TIMESERIES);

mawH; mawL; madP



Safe Pivots

 

Source / From: TOP
Metastockusers [at] yahoogroups [dot] com  

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!