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

Re: [amibroker] Static Arrays???



PureBytes Links

Trading Reference Links





Michael,
AFL operates on entire array at once as described in Tutorial: 
Understanding how AFL works.
 
In order to find out which symbol has the highest volume for the day you in 
fact would need
to run scan TWICE, not once as you do.
First scan would create the highest volume of the day, second scan could 
display the columns of your choice.
 
Also your first call to Foreign() retrieves the value from PREVIOUS scan 
which is not what you want to do.
 
Using new looping it is possible to implement this all in one scan:
 
/* note: if given watch list contains lots of 
symbols ** performance may be poor */function 
GetWatchListHighestVolumeForTheDay( listnum ){ // retrive 
comma-separated list of symbols in watch list list = 
GetCategorySymbols( categoryWatchlist, listnum );<FONT 
face=Tahoma> HiVolume = 0; 
  for( i = 
0; ( sym = StrExtract( list, i ) ) != ""; i++ ) {  
  fv = Foreign( sym, "V" );    for( j = 0; j 
< BarCount; j++ )
    {
      if( HiVolume[ 
j ] < fv[ j ] ) HiVolume[ j ] = fv[ j ];
    }
  
 } return HiVolume;}
HiVolume = 
GetWatchListHighestVolumeForTheDay( 0 ); // for 1st watch 
list
AddColumn(HiVolume, "HighestVolume of all symbols 
in watchlist" );
Filter = 1;
 
Use Apply to: CURRENT 
STOCK
<FONT 
face=Tahoma> 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Michael.S.G. 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, June 26, 2003 7:55 
  AM
  Subject: [amibroker] Static 
  Arrays???
  I can't figure 
  out why I get (apparently) random results when running the following 
  code.It should be Storing the Highest Volume of the day (regardless of 
  which ticker produced it).After running a scan, An explore should show 
  the days highest volume, the assosiated stocks current volume and what the 
  difference is between the two.KRMichael.// Store Highest 
  Volume for the day.// Set "n quotations = 1"// Scan 
  Part:Buy = <FONT 
  face="Courier New, Courier" color=#ff00ff>0<FONT 
  face="Courier New, Courier">; <FONT face="Courier New, Courier" 
  color=#008000>// required by scan mode/* Use ATC as a "Highest Value" 
  Static array */F =  
  Foreign<FONT 
  face="Courier New, Courier">( <FONT face="Courier New, Courier" 
  color=#ff00ff>"~MyIndex", 
  "V"<FONT 
  face="Courier New, Courier">);addTO = <FONT 
  face="Courier New, Courier" color=#0000ff>IIf<FONT 
  face="Courier New, Courier"> (V > F,(V - F), <FONT 
  face="Courier New, Courier" color=#ff00ff>0<FONT 
  face="Courier New, Courier">); <FONT face="Courier New, Courier" 
  color=#0000ff>AddToComposite(addTO, 
  "~MyIndex"<FONT 
  face="Courier New, Courier">, <FONT face="Courier New, Courier" 
  color=#ff00ff>"V",<FONT 
  face="Courier New, Courier" color=#ff00ff>3<FONT 
  face="Courier New, Courier"> 
  );              <FONT 
  face="Courier New, Courier" color=#008000>// Explore Part:<FONT 
  face="Courier New, Courier">FH = <FONT face="Courier New, Courier" 
  color=#0000ff>Foreign( <FONT 
  face="Courier New, Courier" color=#ff00ff>"~MyIndex"<FONT 
  face="Courier New, Courier">, <FONT face="Courier New, Courier" 
  color=#ff00ff>"V");<FONT 
  face="Courier New, Courier" color=#0000ff>AddColumn<FONT 
  face="Courier New, Courier">(FH,<FONT face="Courier New, Courier" 
  color=#ff00ff>"FH-ForeignHighVolume"<FONT 
  face="Courier New, Courier">,<FONT face="Courier New, Courier" 
  color=#ff00ff>1);<FONT 
  face="Courier New, Courier" color=#0000ff>AddColumn<FONT 
  face="Courier New, Courier">(V,<FONT face="Courier New, Courier" 
  color=#ff00ff>"Stocks Volume"<FONT 
  face="Courier New, Courier">,<FONT face="Courier New, Courier" 
  color=#ff00ff>1.2);<FONT 
  face="Courier New, Courier" color=#0000ff>AddColumn<FONT 
  face="Courier New, Courier">(addTO,<FONT face="Courier New, Courier" 
  color=#ff00ff>"To Add",<FONT 
  face="Courier New, Courier" color=#ff00ff>1.2<FONT 
  face="Courier New, Courier">);Filter = <FONT 
  face="Courier New, Courier" color=#ff00ff>1<FONT 
  face="Courier New, Courier">;Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor












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.