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

[amibroker] Repetitive Statements with FOR (?)


  • To: "AmiBroker List" <amibroker@xxxxxxxxxxxxxxx>
  • Subject: [amibroker] Repetitive Statements with FOR (?)
  • From: "Ken Close" <closeks@xxxxxxxx>
  • Date: Mon, 10 Nov 2003 19:33:11 -0800
  • Title: Repetitive Statements with FOR (?)

PureBytes Links

Trading Reference Links







As I venture into the land of more "pure" programming constructs, I stumble.  Any help?

I have a complex series of variables calculating values for today, yesterday, up to Ref(xx,-20)

Instead of

A0 = IIf(Tot<3,colorRed,IIf(Tot>3 AND Tot<5,colorYellow,colorGreen);

A1 = IIf(Ref(Tot,-1)<3,colorRed,IIf(Ref(Tot,-1)>3 AND Ref(Tot,-1)<5,colorYellow,colorGreen);

A2 = IIf(Ref(Tot,-2)<3,colorRed,IIf(Ref(Tot,-2)>3 AND Ref(Tot,-2)<5,colorYellow,colorGreen);

And repeat this 19 times, back 19 days; 

I wanted to try and use a For loop, and tried the following.  But I get all sorts of error messages, the most frequent of which is "Type Mismatch, number expected but array found."


for(i=0; i>19; i++)

{

A[i]=IIf(Ref(Tot,-i)<3,colorRed,IIf(Ref(Tot,-i)>3 AND Ref(Tot,-i)<5,colorYellow,colorGreen);

}

I tried A+I and that did not work either 

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

The "A"s are arrays, so the A[i] seemed like the right way to go, but then the Type Mismatch.

I know the answer is probably simple, but I can not see it.

Help?

Ken








Yahoo! Groups Sponsor


  ADVERTISEMENT 









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.