| 
 PureBytes Links 
Trading Reference Links 
 | 
Hi, To try and learn the new for/if/while I developed following afl. 
Can any of you experts see the error in my code. My for loop works up 
to i=100 but for I>100 gives more than 100 total. Is 100 a 
coincidence or significant? Many thanks in advance.
// count the number of times the same Close price occurs, in 1 cent 
ranges (something like support resistance)
// use exploration on currect stock, all quotations
//number of 1 cents steps from max close to min close
Hy=LastValue(Highest(C));   
Lo=LastValue(Lowest(C));    
range=Hy-Lo;                           
steps=100*range;                   
intsteps=int(round(steps));    
//initialise variable to zero
for(i=0; i<BarCount; i++) myvar[i]=0;  
//step through Close prices (should use j<barcount - works ok to 
i=100 then gives extra values)
for(j=0; j<barcount; j++) 
//for each close step through price ranges 
   for(k=0; k<intsteps; k++) 
      //test if price within range    
      if(C[j]>=Lo+(0.01*k) AND C[j]<Lo+(0.01*k)+0.01) 
      //if in range add 1 else add 0
      myvar[k]=myvar[k]+1; else myvar[k]=myvar[k]+0; 
// results exploration places totals     
Filter=Cum(1)<=intsteps;
AddColumn(IIf(Cum(1)-1<j,C,-1e10),"C in run",1.4);//only show C up to 
jth value ie C values used in the run, blank rest
AddColumn(IIf(Cum(1)-1<k,Cum(1)-1,-1e10),"k",1); //only show k for 
steps
AddColumn(IIf(Cum(1)<=intsteps,Lo+(0.01*(Cum(1)-1)),-
1e10),"lo",1.4); //lo for each k
AddColumn(myvar,"myvar",1); //number of close prices for each k range
AddColumn(Cum(myvar),"cummyvar",1);//highest value should equal j
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/cjB9SD/od7FAA/AG3JAA/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/ 
 |