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

[amibroker] is AFL Stateless?



PureBytes Links

Trading Reference Links




Keith,

Thanks for pointing out my dumb error (vba habits die hard).
Unfortunately I still get the same error with that fix in.

Terry

PS to Bob: I will enlarge the text. It’s the transfer to my Mac that is causing the size problem. I do virtually all email from my Mac to avoid viruses.
--

Terry --
You must use == instead of = for the conditional test in the 'if' statement.  For example:
if (A5 == 1) A1= A2 = 0;

-- Keith

Terry wrote: 
 How to get non array variables?  Problem: I need a variable as a number and not as an array to use in a subscript (see code below). Is there a way to declare variables as array or numeric? I found the global vs. local, but not array vs. numeric.
 
Description: I have several conditions calculated that result in arrays A1...A9. The values of these arrays are either 1, 0 or -1. When A5 = 1, I want to zero out all other arrays for that bar. I keep getting this error: 
 
  
Error 6.
 Array subscript has to be a number
 
 
The Code:
 
//Compute values of A1-A9 first.
 
i=BarCount; //I put this in to try and force a non-array variable. It doesn't work with or without this line.
 
i=BarIndex();
 if (A5[i]=1) //A5 trumps all other A rules so make all others = 0
 A1[i]=A2[i]=A3[i]=A4[i]=A6[i]=A7[i]=A8[i]=A9[i]=0;
 
I suppose there is an array solution that could look something like this:
 A1=A2=A3=A4=A6=A7=A8=A9=IIf(A5=1,0,?);
 but a) I don’t know what to put in the not true part that will leave all the values unchanged and, b) I would like to know how to obtain a number variable. 
 
I could also do this 8 times (once for each array), but it seems so un-elegant:
 A1=IIf(A5=1,0,A1);
A2=IIf(A5=1,0,A2);
...
 
 
Thanks in advance for any solutions.


-- 
Terry




Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.