Hi all
I should appreciate it if you would let me know how to find highest open interest symbol name in watchlist.
. Please consider the following system as an example:
//*******************************************************
listname = CategoryFind("OI", categoryWatchlist );
//******************************************************
symnu =0;
maxoisymno = 1000;
symbolno = 0;
tets="";
syno = 0;
entrydate = 0;
entrytime = 0;
dat = DateNum() ;
TM = TimeNum();
if ( Status( "stocknum" ) == 0 )
{
//StaticVarRemove("*");
for( k = 1; k < BarCount; k++ )
{
List = CategoryGetSymbols(categoryWatchlist, listname );
MaxOI = 0;
for(n = 0; (Symbol = StrExtract(List, n)) != ""; n++)
{
symbolno[k] = n;
f = Foreign( Symbol, "I");
MaxOI = IIf(n == 0, f, Max(f, MaxOI));
if(MaxOI[k] == f[k])
{
maxoisymno = n;
StaticVarSet( "~maxopnum", maxoisymno);
}
RestorePriceArrays();
symnu[k] = maxoisymno;
}
}
}
syno = StaticVarGet ( "~maxopnum" );
Filter = 1;
AddColumn( DateTime(), "Date", formatDateTime , colorDefault, bkgndColor = colorDefault, width = 150, barchart = Null);
AddColumn(Foreign(StrExtract( List, 0 ), "I"),"440CE",1.2, colorDefault, bkgndColor = colorDefault, width = 75, barchart = Null);
AddColumn(Foreign(StrExtract( List, 1 ), "I"),"450CE",1.2, colorDefault, bkgndColor = colorDefault, width = 75, barchart = Null);
AddColumn(Foreign(StrExtract( List, 2 ), "I"),"460CE",1.2, colorDefault, bkgndColor = colorDefault, width = 75, barchart = Null);
AddColumn(Foreign(StrExtract( List, 3 ), "I"),"470CE",1.2, colorDefault, bkgndColor = colorDefault, width = 75, barchart = Null);
AddColumn(MaxOI,"HighestOI",1.2, colorDefault, bkgndColor = colorDefault, width = 75, barchart = Null);
AddColumn(symnu,"HighestOINum",1.2, colorDefault, bkgndColor = colorDefault, width = 100, barchart = Null);
AddTextColumn(StrExtract( List, syno ),"HighestOISymbol",1.2, colorDefault, bkgndColor = colorDefault, width = 100);
Thanks.