looks good. Does it actually help?
Correlation stuff was always a let down to me. It never worked when I needed it the most.
There can always be improvements to codes, if it gets the job done, I usually don't bother, that's me trading, instead of "coding". I believe in getting reliable results quickly for evaluation, then revisiting the code.
Signal object can also check the symbol: sig.Symbol
Below you could iterate through a list of strings separated by comma, that might be useful to you. You could make (if necessary) your code more flexible by putting all your high correlation symbols into a watchlist or sectorlist. Say Grains: wlnum=0, rates: wlnum:1 etc.
function CategoryCountSymbols( category, number )
{
count = StrCount( list = CategoryGetSymbols( category, number ), ",");
return IIf( list == "", 0, count + 1 );
}
Title = "Symbols in watchlist 0: " + CategoryCountSymbols( categoryWatchlist, 0 );
from here: count symbols
Then you could use
CategoryGetSymbols( category, index, mode = 0 )
category online examples
Basically what it "automates" is you can now iterate through all symbols in your watchlist and you don't need to type the symbol name out in CBT.
this one will iterate through your list of symbols:
// retrive comma-separated list of symbols in watch list
list = CategoryGetSymbols( categoryWatchlist, listnum );
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
// do something here;
}
What might be even more interesting is to take only the signal from, i.e. the "grains" watchlist with the highest PositionScore (depends on what you exactly do).