Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 1,394 Location: Glastonbury, CT
Was thanked: 2 time(s) in 2 post(s)
|
Indicators
Gann-Swing{Adam Hefner}
{Market swing is defined as:
Up = 2 higher highs,
Down = 2 lower highs.}
Us:=BarsSince((H > Ref(H,-1)) AND (Ref(H,-1) >
Ref(H,-2)));
Ds:=BarsSince((L < Ref(L,-1)) AND (Ref(L,-1) <
Ref(L,-2)));
Sd1:=If(Us=0,
{then}If(Ref(L,-1)<>LowestSince(1,Ds=0,L),
{then}1,
{else}0),
{else}If(Ds=0,
{then}If(Ref(H,-1)<>
HighestSince(1,Us=0,H),
{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;
_____________________________________
Gann-Trend {Adam Hefner}
{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;
Expert by Henry 1224
Highlights
Long
ut:=FmlVar("GANN-Trend","TDV");
A:=FmlVar("GANN-Swing","TD1");
Ut>0 AND A>0
Short
ut:=FmlVar("GANN-Trend","TDV");
A:=FmlVar("GANN-Swing","TD1");
Ut<0 AND A<0
Out
ut:=FmlVar("GANN-Trend","TDV");
A:=FmlVar("GANN-Swing","TD1");
Long:=Ut>0 AND A>0;
Short:=Ut<0 AND A<0;
Out:=Long<>1 OR Short<>1;
Out=1
Symbols
Long entry
ut:=FmlVar("GANN-Trend","TDV");
A:=FmlVar("GANN-Swing","TD1");
Long:=Ut>0 AND A>0;
Long=1 AND Ref(Long,-1)<1
Short entry
ut:=FmlVar("GANN-Trend","TDV");
A:=FmlVar("GANN-Swing","TD1");
Short:=Ut<0 AND A<0;
Short=1 AND Ref(Short,-1)<1
Long exit
ut:=FmlVar("GANN-Trend","TDV");
A:=FmlVar("GANN-Swing","TD1");
Long:=Ut>0 AND A>0;
Short:=Ut<0 AND A<0;
Out:=Long<>1 OR Short<>1;
Out=1 AND Ref(Long,-1)>0 AND Long=0
Short exit
ut:=FmlVar("GANN-Trend","TDV");
A:=FmlVar("GANN-Swing","TD1");
Long:=Ut>0 AND A>0;
Short:=Ut<0 AND A<0;
Out:=Long<>1 OR Short<>1;
Out=1 AND Ref(Short,-1)>0 AND Short=0
|