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

Re: [amibroker] Directional Movement



PureBytes Links

Trading Reference Links




<FONT face=Arial 
color=#0000ff>If you use the subscript <FONT 
color=#000000>Count[j]++; you are filling the array starting at position 
zero, up to Count[500] in your case. All bars beyond index 500 will contain a 
NULL (-1e10) and this is an unacceptable values for an array subscript. I 
am not sure what you are trying to do, but the following code would ensure 
that your subscript stays in a valid range:

  Count=<FONT 
  color=#ff00ff>0<FONT 
  color=#000000>; j=1<FONT 
  size=2>; <FONT 
  color=#ff0000>for(j=<FONT 
  color=#ff00ff>1; j<<FONT 
  color=#ff0000>BarCount<FONT 
  face=Arial>; j++)    { 
     if<FONT 
  color=#000000>(j<500<FONT 
  size=2>) Count[j]++; 
     else<FONT 
  color=#000000> Count[j]=0<FONT 
  size=2>;    } 
  Plot<FONT 
  color=#000000>(Count,""<FONT 
  color=#000000>,colorRed<FONT 
  color=#000000>,styleHistogram<FONT 
  color=#000000>|4<FONT 
  size=2>); <FONT 
  color=#ff0000>GraphXSpace = <FONT 
  color=#ff00ff>5<FONT face=Arial 
  size=2>; 
<FONT face=Arial 
size=2>However, I think what you are looking for is 
this:

  Count=<FONT 
  color=#ff00ff>0<FONT 
  color=#000000>; j=1<FONT 
  size=2>; <FONT 
  color=#ff0000>for(j=<FONT 
  color=#ff00ff>1; j<<FONT 
  color=#ff0000>BarCount<FONT 
  face=Arial>; j++)    {    
  if<FONT 
  color=#000000>(j<500<FONT 
  size=2>) Count[j] = j;    
  else 
  Count[j]=null<FONT 
  color=#000000>;    } <FONT 
  color=#0000ff>Plot(Count,<FONT 
  color=#ff00ff>"",<FONT 
  color=#ff0000>colorRed,<FONT 
  color=#ff0000>styleHistogram|<FONT 
  color=#ff00ff>4<FONT 
  color=#000000>); GraphXSpace<FONT 
  color=#000000> = 5; 
  
<FONT 
face=Arial>G<SPAN 
class=030401804-18012004>ood luck,
<SPAN 
class=030401804-18012004><FONT 
color=#0000ff>h<SPAN 
class=030401804-18012004>erman
<FONT face=Arial 
size=2> 
<FONT face=Arial 
size=2> 

  <FONT face=Arial 
  size=2>-----Original Message-----From: kk2628 
  [mailto:kk2628@xxxxxxxxxxxxxxxx]Sent: January 18, 2004 11:50 
  AMTo: amibroker@xxxxxxxxxxxxxxx; 
  bugs@xxxxxxxxxxxxxSubject: [amibroker] Strange subscript out of 
  range
  Hi TJ,
   
  The following is just a simple for loop. What I 
  do not understand is I'll get the subscript out of range error when there is 
  about a year data show on screen. When I use the zoom out button so that the 
  screen will show more data (may be 6 years), then the subscript out of 
  range error not happening. TJ, would appreciate your 
  clarification.
   
  Tks
  KK
  
  Count=<FONT 
  color=#ff00ff>0<FONT face=Arial 
  size=2>;
  j=<FONT 
  color=#ff00ff>1;<FONT 
  color=#800000>
  for<FONT 
  face=Arial>(j=1<FONT 
  color=#000000>; j<=<FONT 
  color=#ff00ff>500; 
  j++)
  { 
  
  Count[j]++;
  }
  Plot<FONT 
  face=Arial>(Count,<FONT 
  color=#ff00ff>""<FONT 
  color=#000000>,colorRed,styleHistogram|<FONT 
  color=#ff00ff>4);
   <FONT face=Arial 
  size=2>Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
  <FONT 
  face=Arial 
  size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face=Arial size=2>--------------------------------------------Check group 
  FAQ at: <A 
  href=""><FONT 
  face=Arial 
  size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
  size=2> 
  <FONT 
  face=Arial size=2>
  
  Yahoo! Groups Links
  
    To visit your group on the web, go 
    to:<FONT 
    face=Arial 
    size=2>http://groups.yahoo.com/group/amibroker/<FONT 
    face=Arial size=2>  
    To unsubscribe from this group, send an email 
    to:<A 
    href=""><FONT 
    face=Arial size=2>amibroker-unsubscribe@xxxxxxxxxxxxxxx<FONT 
    face=Arial size=2>  
    Your use of Yahoo! Groups is subject to the 
    <FONT face=Arial 
    size=2>Yahoo! Terms of Service. 
    


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





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.