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

Re: [amibroker] Bugged out (2)



PureBytes Links

Trading Reference Links

Hello,

I wrote about this many times already.
If - else NEEDS to know WHICH execution path to take.
Hence it needs either TRUE or FALSE (single value).
You supply it with ARRAY of values, so If can not decide
which path to take if you supply it with hundeds of values.
You either need to use loop to iterate through array values
and use [] subscript operator (as the error message already
told you). Or don't use If at all.

You supply the code but since it has so many errors
it is not clear what you want to code. Therefore it would
be better to describe first what this code is supposed to do.

By the way the condition:
DateNum()==Status("rangefromdate") AND DateNum()==Status ("rangetodate"));

would NEVER be met (until your FROM date equals TO date).

AND clause requires BOTH conditions to be met at the same time.
So your condition says if something like this "if today is monday and today is friday" (at the same time = not possible)

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "rlb21079" <rlb21079@xxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, May 25, 2003 4:12 PM
Subject: [amibroker] Bugged out (2)


> Code:
> -----
> if (DateNum()==Status("rangefromdate") AND DateNum()==Status
> ("rangetodate"));
> {
> AddToComposite(V,"~TICKER1","V",16);
> 
> AddToComposite(IIf(C>Ref(C,-1),1,IIf(C<Ref(C,-1),-
> 1,0)),"~TICKER1","C",16);
> }
> 
> NumHighest=15;
> while (NumHighest>0)
> {
> NumHighest=NumHighest-1;
> HoldValue=ValueWhen(Highest(Foreign("~TICKER1","V")),Foreign
> ("~TICKER1","C"),1);
> AddToComposite(HoldValue,"~TICKER1","H",16);
> }
> 
> AddColumn(V,"Volume",1.0);
> AddColumn(C-Ref(C,-1),"Change");
> AddColumn(IIf(C>Ref(C,-1),1,IIf(C<Ref(C,-1),-1,0)),"ChCount",1.0);
> Filter=V>3000000;
> 
> Error:
> -----
> Line 3, Column 1:
> if (DateNum()==Status("rangefromdate") AND DateNum()==Status
> ("rangetodate"));
> 
> {
> ^
> 
> 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
> 
> In this the if statement seems to function, in that the V and C 
> fields of ~TICKER1 are now correct.  I have speant hours on this and 
> looking at examples which for the life of me I can't see as being any 
> different.  I have tried many variations too with similar results.  
> TO be honest, I don't know why this has any positive result while 
> Bugged Out(1) does not.
> S.O.S.
> Rich
> 
> 
> 
> 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/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/CNxFAA/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/