PureBytes Links
Trading Reference Links
|
The following is my AFL code:
--------------------------------------------------------------
function GannSwing(H,L,C)
{/*{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(Us==0,H,1);
Lc=LowestSince(Ds==0,L,1);
Sd1=IIf(Us==0,
IIf((L!=Lc) AND (Ref(L,-1)!=Lc),
1,
0),
IIf(Ds==0,
IIf((H!=HC) AND (Ref(H,-1)!=Hc),
-1,
0),
0));
Sd2=IIf(Sd1==1,
IIf(Ref(BarsSince(Sd1==1),-1) >
Ref(BarsSince(Sd1==-1),-1),
1,
0),
IIf(Sd1==-1,
IIf(Ref(BarsSince(Sd1==1),-1) <
Ref(BarsSince(Sd1==-1),-1),
-1,
0),
0));
TD1=ValueWhen(Sd2!=0,Sd2,1);
return TD1;
}
function SwingGann()
{
BarHigh=0;
BarLow=0;
MyHigh=-9999;
MyLow=9999;
M=GannSwing(H,L,C);
for(i=0; i<BarCount; i++)
{
if(M[i]>0)
{if(H[i]>=MyHigh)
{ MyHigh=H[i];
BarHigh=i;
myLow=9999;
Swing[BarLow]=MyLow;}
}
else
{if(M[i]<0)
{if(L[i]<=MyLow)
{ MyLow=L[i];
BarLow=i;
myHigh=-9999;
Swing[BarHigh]=MyHigh;}
}}
}
return Swing;
}
Plot(-SwingGann(),"",colorYellow);
----------------------------------------------------------
Problem:
1)AFL code to Convert -SwingGann value 9999 as High,
-SwingGann value -9999 as low, and draw Swing Lines
2)How to eliminate -SwingGann Zero value or convert to null
Thank anyone can provide the codes
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|