| 
 PureBytes Links 
Trading Reference Links 
 | 
  
In another attempt to rank in a different manner I spent a week or so
trying the get the Osaka plug in to produce ranked results.  I have
been able to get it to do only the simplest of tasks.  As soon as I
try to set it up to actually rank some real indicator values I have
severe problems with the AB code to get the symbols and indicator values
into Osaka, let alone trying to get the supposedly ranked values out of
the table.  I have read all the Osaka related posts and tried all
the code examples, no joy.
  
Hers is some code I have been working with.  There is probably more
than one error in here.
  
/*  
The code below should be explored against a smallish watchlist, say 20
 
symbols. It creates AND saves a table while the first stock is being
 
processed, AND instead of recreating it for subsequent stocks, loads it
from  
disk. The idea is that if lots of processing was required to create the
 
table (unlike this simple test), it'd only have to be done once for the
 
whole test run. 
  
Dave Merrill  
---------------------- */ 
  
// CONFIG  
List = 14;
// watchlist to examine; must be list
under test; 14 = C8080 list  
NumberOfTestColumns =
5;
// 66, three months of data per
stock  
MomPer =
14;
// Optimize("MomPer", 14, 4, 21,
1); 
  
// FUNCTIONS
 
function
fListLen(List) {  
      i =
0;  
     
while
(StrExtract(List,
i) !=
"")
i++;  
     
return i;
 
} 
  
// init  
TickerList =
CategoryGetSymbols
(categoryWatchlist, List);  
CountTickers = fListLen(TickerList);  
StockNum =
Status(
"StockNum"
);      
// # of stocks in the
list  
FirstStock = (StockNum ==
0); 
  
// init table, make col for each bar
in test  
osInitialize();
 
table =
osTabCreate();
 
osTabAddColumn
("Symbol"
, 2,
table,
StrSize=6);
  
if
(FirstStock) {  
     
for(i =
1; i <=
NumberOfTestColumns; i++) {  
           
osTabAddColumn
("MAM"
+ i, 1, table);
 
      }  
     
osTabSave(
, table);  
} else {
 
     
osTabLoad(
, table);  
} 
  
ColCount =
osTabGetColumnCount
(table); 
  
 
// Now fill the columns with some
useful data.  
// CALCULATING SCORES and saving them
to the table  // this area is new and needs
testing  
score =
100*(Close
/MA(Close,
(2*MomPer)
+1)
-1); 
// MAM 
  
for
(i=0; (ticker =
StrExtract
(TickerList, i)) !=
""; i++
)  
{ 
  
 
SetForeign
(ticker);  
osTabSetString(
ticker, i, 0,
table );  // the table is
filling with the symbols and fixed data, but no MAM
  
for( j =
0; j <=
NumberOfTestColumns; j++ )  
  {  
  
osTabSetNumber(
score[ j ], i, j , table );  
  }  
}  
osTabExport
("MAM_table_fill.csv"
,","
, table);  
// Sort the table
  
osTabSort(table,
5 ); 
// sort by last column,
66  
Output =
"";
 
for( i =
0; i <
10; i++ ) 
// top ten MAM
rankings  
{  
  Output = Output  +
osTabGet( i,
0, table ) +
", "
+  osTabGet(
i, 1 , table ) +
"\n";
// symbol and
rank  
} 
  
Output; 
  
Filter =
1;
//Status("LastBarInTest");
  
AddColumn
(ColCount,
"ColCount"
,
1.0);  
AddColumn
(StockNum,
"StockNum"
,
1.0);  
AddColumn
(CountTickers,
"CountTickers"
,
1.0);  
AddColumn(table,
"table"
, 1.0);  
AddColumn(score,
"MAM",
7.1);  
//AddColumn(MAM,
"Rank"); 
  
// clean up  
osTabDelete
(table); 
  
Please note that this group is for discussion between users only. 
 
To get support from AmiBroker please send an e-mail directly to  
SUPPORT {at} amibroker.com 
 
For other support material please check also: 
http://www.amibroker.com/support.html 
 
  
---- LSpots keywords ?>
  ---- HM ADS ?>
  
 
  
    
  YAHOO! GROUPS LINKS
 
 
    
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.8/37 - Release Date: 7/1/2005
 
 |