Hi Stewart,
This can best be achieved using a simple external function. You can either test the name of the current stock and return a true false answer, or you can create lists of different stocks ans test to see which list the current stock is in.
The other way to do it is long, ugly and slow; it involves using the Security() function to compare the prices in the current open data file with the prices as described in the Security() function, if they match exactly there is a good chance (but no guarantee) you have found the right stock ticker.
You don't necessarily need to define every data item (O,H,L,C,V,OI) but it is the surest way to find an exact match; use as many criteria as you actually need, CLOSE and VOLUME might be sufficient?
|
threshold:=20; otherDataC:=security(path to BHP,C); otherDataV:=security(path to BHP,V); test:=lastvalue(cum((C-otherDataC)<>0)+((V-otherDataV)<>0))=0; threshold:=if(test,17,threshold);
otherDataC:=security(path to MSFT,C);
otherDataV:=security(path to MSFT,V);
test:=lastvalue(cum((C-otherDataC)<>0)+((V-otherDataV)<>0))=0; threshold:=if(test,14,threshold);
{etc etc etc.... ugly and slow}
{return} RSI(C,2)<threshold; |
This method is not guaranteed to return the right results... for example, disparities between data files in multiple directories will return erroneous results.
wabbit
"The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
Edsgar W. Dijkstra
MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
For custom MetaStock programming : http://www.wabbit.com.au
My SkyPE status : 
My SkyPE account : wabbit.com.au