You need to put function definition BEFORE the call.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: murthysuresh
To: [email protected]
Sent: Monday, December 11, 2006 6:12 PM
Subject: [amibroker] I get syntax error. Not sure why.
Hello
I get syntax error. at the highlighted line. "a=CheckIfHeldThroThreshold(C,
L,5,9); // this is where i get syntax error. not sure why?"not sure why. can
someone point out why.
Thanks
result9=IIf((L>=EMA(C,9) ) AND (L>EMA(C,20) )AND (L>EMA(C,33) )AND
(L>MA(C,50) ),9,0);
result20=IIf((L<EMA(C,9) ) AND (L>=EMA(C,20) )AND (L>EMA(C,33) )AND
(L>MA(C,50) ),20,0);
result33=IIf((L<EMA(C,9) ) AND (L<EMA(C,20) )AND (L>=EMA(C,33) )AND
(L>MA(C,50) ),33,0);
result50=IIf((L<EMA(C,9) ) AND (L<EMA(C,20) )AND (L<EMA(C,33) )AND
(L>=MA(C,50) ),50,0);
AddColumn(IIf(result9+result20+result33+result50<=0,0,result9+result20+result33+result50),"Result");
//AddTextColumn(IIf(result9+result20+result33+result50<=0,0,CheckIfHeldThroThreshold(Close,
Low,5,9)),"Kept above threshold",1.2);
a=CheckIfHeldThroThreshold(C, L,5,9); // this is where i get syntax error.
not sure why?
Filter =C>MA(C,200);
function CheckIfHeldThroThreshold(inputClose,
inputLow,noOfDaysofThreshold,movingAveToBeUsed){
bHeldAboveThreshold=True;
for (daysChecking=0;daysChecking<noOfDaysofThreshold;daysChecking++){
if(inputLow[-1 *daysChecking]< EMA(inputClose,movingAveToBeUsed){
bHeldAboveThreshold=False;
}
}
return bHeldAboveThreshold;
}