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

Re: [amibroker] Dyanimic Position Size


  • Href="">http: //www.amibroker.com/guide/a_language.html ----- Original Message ----- <DIV >From: Terry

PureBytes Links

Trading Reference Links

  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">Amibroker 
  Sent: Monday, July 26, 2004 5:29 PM
  Subject: [amibroker] 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 <FONT 
    color=#ff00ff>6.Array subscript has to be a 
    number<SPAN 
  >The Code:<SPAN 
  >//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=<FONT 
  color=#0000ff>BarIndex();if 
  (A5[i]=1) //A5 trumps all other A rules so make all others 
  = 0A1[i]=A2[i]=A3[i]=A4[i]=A6[i]=A7[i]=A8[i]=A9[i]=<FONT 
  color=#ff00ff>0;I suppose there is an 
  array solution that could look something like this:<FONT 
  face=Courier>A1=A2=A3=A4=A6=A7=A8=A9=<FONT 
  color=#0000ff>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=<FONT 
  color=#0000ff>IIf(A5=1,0,A1);A2=<FONT 
  color=#0000ff>IIf(A5=1,0,A2);...<FONT 
  face=Arial>Thanks in advance for any solutions.-- 
  TerryCheck AmiBroker web page at:<A 
  href="">http://www.amibroker.com/Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


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.