This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
Gann Swing overlayBack to topics list |
|
Desiderius
2005.07.13 07:47
Has anybody done anything to build a Gann swing indicator? This is the traditional 3-day indicator.
I am very interested in building this indicator, but need help with setting up the code to check each bar with the bar arrays working in reverse. Thanks Des |
|
Desiderius
2005.07.13 07:51
I found the following code on a MetaStock site.
Gann-Swing - Metastock Indicator Formula by 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; |
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
