[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Beginner's Error



PureBytes Links

Trading Reference Links

Conrad,
Do you perhaps wish to use "IIF" instead of "IF"? The other problem may be
that you need to assign the question to a variable...something like "X= my
iif statement" try.....

Graph1 = Ref(L, 3);
Graph2 = Ref(L, 2);
Graph3 = Ref(L, 1);
Graph4 = Ref(L, -1);
Graph5 = Ref(L, -2);
Graph6 = Ref(L, -3);

x=IIf ((Graph1 > L) AND (Graph2 > L) AND (Graph3 > L) AND (Graph4 > L) AND
(Graph5 > L) AND (Graph6 >
L),1,2);

WriteVal(x);

You can try it as a guru commentary to see how it works



Regards,
Jayson
-----Original Message-----
From: Conrad Smith [mailto:conradfsmith3@xxxxxxxxx]
Sent: Tuesday, November 11, 2003 1:51 PM
To: Amibroker
Subject: [amibroker] Beginner's Error


I require a bit of help with the following error:

The code:

graph1 = Ref(L, 3)
graph2 = Ref(L, 2)
graph3 = Ref(L, 1)
graph4 = Ref(L, -1)
graph5 = Ref(L, -2)
graph6 = Ref(L, -3)

If (graph1 > L AND graph2 > L AND graph3 > L AND graph4 > L AND graph5 > L
AND graph6 > L)
{
  "Hot Damn!";
}


Note, "Hot Damn!" will eventually be replace with a call to the PlotShape
function.


The error:

Error in AFL formula:
Line 11, Column 2:
if ((Graph1 > L) AND (Graph2 > L) AND (Graph3 > L) AND (Graph4 > L) AND
(Graph5 > L) AND (Graph6 >
L))

{

  "Hot Damn!";

}
-^

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


I've replace the IF statement above with '(2 > 1)' and the error goes away,
so I'm certain that is
what the error pertains to.  So how should I go about comparing the nearby
days to the target
date?


For those whom are interested, this is my attempt to code a Class 3 Support
point as outlined by
John Clayburg.


Thanks for any help.
Conrad

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk


Yahoo! Groups Sponsor



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

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



------------------------ 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
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/