PureBytes Links
Trading Reference Links
|
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;
}
BarHigh=0;
BarLow=0;
for(i=0; i<BarCount; i++)
{ M=GannSwing(H,L,C);
MyHigh=-9999;
MyLow=9999;
while(M>0)
{ if(H[i]>=MyHigh)
{ MyHigh=H[i];
BarHigh=i;}
}
Swing[BarHigh]=MyHigh;
while(M<0)
{ if(L[i]<=MyLow)
{ MyLow=L[i];
BarLow=i; }
}
Swing[BarLow]=MyLow;
}
--------------------------------------------------
---------------------------------------------------------------------
ERROR Message
-------------------------
Line 54, Column 1:
BarLow=i; }
}
Swing[BarLow]=MyLow;
}
^
Error 3.
Condition in IF, WHILE, FOR statements
has to be Numeric or Boolean type.
You can not use array here,
please use [] (array subscript operator)
to access array elements
Can anyone help me to complete it and show me where is the error
Thank
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 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/
|