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 #

Support & Resistance - Peaks/Troughs by Jose Silva
Plots Support & Resistance levels based on two types of Peaks/Troughs, fully adjustable.

Support & Resistance - Peaks/Troughs

{ Support & Resistance v2.0 }
{ Plots support/resistance levels based on
normal or hindsight peaks/troughs }
{ ©Copyright 2004 Jose Silva }
{ http://www.metastocktools.com }

{ User inputs }
plot:=Input("[1]Support, [2]Resistance, [3]Both, [4]Combination",1,4,3);
x:=Input("use [1]High/Low, [2]Close",1,2,1);
type:=Input("Type: [1]Normal, [2]Hindsight",
1,2,1);
depth:=Input("Peak/Trough minimum depth (0~50%)",0,50,5);
pds:=Input("Peak/Trough period base (3~252)",
3,252,5);

{ Price field }
xHi:=If(x=1,H,C);
xLo:=If(x=1,L,C);

{ Non-hindsight Support/Resistance }
Hi:=
(HHV(xHi,pds-1)>xHi)>Ref(HHV(xHi,pds-1)>xHi,-1);
HiVal1:=ValueWhen(1,Hi,Ref(xHi,-1));
Lo:=
(LLV(xLo,pds-1)<xLo)>Ref(LLV(xLo,pds-1)<xLo,-1);
LoVal1:=ValueWhen(1,Lo,Ref(xLo,-1));
Hi:=Hi AND HiVal1>LoVal1*(1+depth/100);
Lo:=Lo AND LoVal1<HiVal1*(1-depth/100);
supp:=ValueWhen(1,Lo,Ref(xLo,-1));
res:=ValueWhen(1,Hi,Ref(xHi,-1));
comb:=If(BarsSince(Hi)<BarsSince(Lo),res,supp);

{ Hindsight Support/Resistance }
pkH:=PeakBars(1,xHi,depth);
trH:=TroughBars(1,xLo,depth);
suppH:=Trough(1,xLo,depth);
resH:=Peak(1,xHi,depth);
combH:=If(pkH<trH,resH,suppH);

{ Chosen Support/Resistance }
supp:=If(type=1,supp, suppH);
res:=If(type=1,res,resH);
comb:=If(type=1,comb,combH);

{ Plot on price chart }
If(plot=1,supp,If(plot=2,res,
If(plot=3,res,comb)));
If(plot=1,supp,If(plot=2,res,
If(plot=3,supp,comb)))

 

Source / From: TOP
http://www.metastocktools.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!