PDA

View Full Version : Gann Trend



Objektif
18-11-2004, 12:27
Gann-Trend - Metastock Indicator Formula
by Adam Hefner



http://www.hisse.net/okul/ms/ganntrend.png



{Swing Direction}
Sd:= FmlVar("Gann Swing","TD1") ;
{Swing Change High}
Sch:=If(Sd=1 AND Ref(sd,-1)=-1,
{then}1,
{else}0);
{Swing Change Low}
Scl:=If(Sd=-1 AND Ref(Sd,-1)=1,
{then}1,
{else}0);
{Peak Value}
Pv:=If(Scl=1,
{then}HighestSince(1,Sch=1,H),
{else}0);
{Trough Value}
Tv:=If(Sch=1,
{then}LowestSince(1,Scl=1,L),
{else}0);
{Trend Direction}
Td:=If(H>ValueWhen(1,Pv>0,Pv),
{then}1,
{else}If(L<ValueWhen(1,Tv>0,Tv),
{then}-1,
{else}0));
{UpTrend=1 DownTrend =-1}
Tdv:=ValueWhen(1,Td<>0,Td);
Tdv;

50ot
19-11-2004, 00:07
no indicator names in the indicator builder contain this text diyor, baþka birþey demiyor...

{Swing Direction}
Sd:= FmlVar("Gann Swing","TD1")

þurada takýlýp kalýyor.. bu multidefinition kodlar, indikator builder'a mý yazýlýyor?

metin6144
19-11-2004, 00:18
asagidaki formülü Gann Swing adiyla eklerseniz sorun çözülecektir kolay gelsin

{Market swing is defined as:
Up = 2 higher highs,
Down = 2 lower lows.}
Us:=BarsSince(Sum(H>Ref(H,-1),2)=2);
Ds:=BarsSince(Sum(L<Ref(L,-1),2)=2);
Hc:=HighestSince(1,Us=0,H);
Lc:=LowestSince(1,Ds=0,L);
Sd1:=If(Us=0,
{then}If((L<>Lc) AND (Ref(L,-1)<>Lc),
{then}1,
{else}0),
{else}If(Ds=0,
{then}If((H<>HC) AND (Ref(H,-1)<>Hc),
{then}-1,
{else}0),
{else}0));
Sd2:=If(Sd1=1,
{then} If(Ref(BarsSince(Sd1=1),-1) >
Ref(BarsSince(Sd1=-1),-1),
{then}1,
{else}0),
{else} If(Sd1=-1,
{then}If(Ref(BarsSince(Sd1=1),-1) <
Ref(BarsSince(Sd1=-1),-1),
{then}-1,
{else}0),
{else}0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
Td1;