Hi,
I am trying to use the function NorgateIndexConstituentTimeSeriesOther() in a code that stores a score in a Static Variable for each symbol, which is used later in a ranking process. I am doing this in US, CAN and AUS Universes, and it is working ok for US, but for CAN and AUS I am getting and empty Static Variable.
Here is a snippet for running a Explore analysis in three indexes, one for each country. It should outputs 1/0 based on index constituents on a given day:
#include_once "Formulas\Norgate Data\Norgate Data Functions.afl"
_SECTION_BEGIN("Historical Data Base Testing");
//---------------------------------------------------------------------------------
USList = ParamList("AUS Historical Watchlist v1:","0: Off|1: All Ordinaries|2: Russell 1000|3: SP/TSX Composite", 1);
if(USList == "0: Off") USHistDB = "";
if(USList == "1: All Ordinaries") USHistDB = "$XAO.au";
if(USList == "2: Russell 1000") USHistDB = "$RUI";
if(USList == "3: SP/TSX Composite") USHistDB = "$SPTSX.ca";
if ( Status("stocknum") == 0 ){
StaticVarRemove( "*" );
list_num = GetOption("FilterIncludeWatchlist");
list_name = CategoryGetName( categoryWatchlist, list_num );
stocksList = CategoryGetSymbols( categoryWatchlist, list_num, mode = 0 );
for( n = 0; ( symbol = StrExtract( stocksList , n ) ) != ""; n++ ){
HDB = NorgateIndexConstituentTimeSeriesOther(USHistDB, symbol);
StaticVarSet ( "InIndex" + StrToUpper(symbol), HDB );
}
}
inDB = StaticVarGet( "InIndex" + StrToUpper(Name()) );
Buy = 0;
Sell = 0;
if(Status("action")==actionExplore){
SetOption("NoDefaultColumns",True);
Filter = 1;
AddColumn( DateTime(), "Date", formatDateTimeISO );
AddTextColumn(Name(),"Ticker");
AddColumn(inDB, "StockInIndex");
SetSortColumns(1);
}
PD1: I already set the "Pad and align all data to reference symbol" to the corresponding index.
PD2: I need to use StaticVariables because I want to implement a Rotational system with an stop based on ATR (bar-by-bar), so I can't use backtestRotational mode.
Thanks.