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 #

GANN Swing Expert
Bez formuł: "GANN - Swing", "GANN - Trend" "GaW-Trend" Expert nie "ruszy".
Potrzebne formuły należy najpierw wprowadzić do modułu "Indicator Builder" - oto one:

GANN - Swing

Us:=BarsSince((H > Ref(H,-1)) AND (Ref(H,-1) >
Ref(H,-2)));
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}1,
{else}0),
{else} If(Sd1=-1,
{then}-1,
{else}0),
{else}0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
Td1;

Poniższa formuła wymaga wcześniejszego wprowadzenia formuły znajdujące się powyżej pod niezmodyfikowaną nazwą.

GANN - Trend

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

GaW-Swing

Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
Wh:=If(Dw=1,
{then}Ref(HighestSince(1,Dw=1,H),-1),
{else}0);
Wl:=If(Dw=1,
{then}Ref(LowestSince(1,Dw=1,L),-1),
{else}0);
Hv1:=ValueWhen(1,Wh>0,Wh);
Hv2:=ValueWhen(2,Wh>0,Wh);
Hv3:=ValueWhen(3,Wh>0,Wh);
Lv1:=ValueWhen(1,Wl>0,Wl);
Lv2:=ValueWhen(2,Wl>0,Wl);
Lv3:=ValueWhen(3,Wl>0,Wl);
Us:=BarsSince((Hv1 > Hv2) AND (Hv2 > Hv3));
Ds:=BarsSince((Lv1 < Lv2) AND (Lv2 < Lv3));
Hc:=Ref(HighestSince(1,Us=0 AND Ref(Us,-1)>0,H),
-1);
Lc:=Ref(LowestSince(1,Ds=0 AND Ref(Ds,-1)>0,L),
-1);
{Swing direction Calculation}
Sd1:=If(Us=0 AND Dw=1,
{then}If((Lv1<>Lc) AND (Lv2<>Lc),
{then}1,
{else}0),
{else}If(Ds=0,
{then}If((Hv1<>Hc) AND (Hv2<>Hc),
{then}-1,
{else}0),
{else}0));
Sd2:=If(Sd1=1,
{then}1,
{else}0),
{else} If(Sd1=-1,
{then}-1,
{else}0),
{else}0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
TD1

Poniższa formuła wymaga wcześniejszego wprowadzenia formuły znajdujące się powyżej pod niezmodyfikowaną nazwą.

GaW-Trend

Sd:= FmlVar("GaW-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

1. First create a new expert and name it whatever you want.

2a. under " Trends" tab put this code for Bullish :

ut:=FmlVar("GANN - Trend","TDV");
uplot=1;

2b. and this for Bearish :

dt:=FmlVar("GANN - Trend","TDV");
dplot=1;

Then click on the "ribbon" option and turn off "Display Vertical Lines", I also turn off the corner option.

3a. Under highlights tab create a new and call it "HiLo Change ", choose color, and enter this code:

HLd:=If(CLOSE>Ref(Mov(H,3,S),-1),
{then}1,
{else}If(CLOSE<Ref(Mov(L,3,S),
-1),
{then}-1,
{else}0));
HLv:=ValueWhen(1,HLd<>0,HLd);
HLv<>Ref(HLv,-1);

3b. Create new and call it "Up-Trend" , choose color, and enter this code:

ut:=FmlVar("GANN - Trend","TDV");
uplot=1;

3c. Create new and call it "Down-Trend ", choose color, and enter this code:

dt:=FmlVar("GANN - Trend","TDV");
dplot=1;

4a. Under "Symbols" tab create new and call it "UpSwing", enter this code:

FmlVar("GANN - Swing","SD2")=1;

then under graphic choose "Buy Arrow", choose color (Dark Green), and small size, then pick "Above Price Plot".

4b. Create new and call it "DownSwing ", enter this code:

FmlVar("GANN - Swing","SD2")=-1;

then under graphic choose "sell arrow", choose color (Dark Red), and small size, then pick "Below Price Plot".

As for the HiLo ....just plot it as a regular indicator and choose the last "style" option under "color/style" tab.

Note: For daily bar charts ribbon use these formulas:

2a.
ut:= FmlVar("GaW-Trend","TDV") ;
uplot=1;

2b.
dt:= FmlVar("GaW-Trend","TDV") ;
dplot=1;

Source / From: TOP