Hello,
I have passed this on to Norgate Data support, but maybe someone can help me.
When placed in a static variable to perform ranking NorgateIndexConstituentTimeSeriesOther() generates inconsistent results which appear to be linked to the presence of a delisted symbol in the watchlist. Outside the classic if ( Status( "stocknum" ) == 0 ) section the function generates results that are identical to NorgateIndexConstituentTimeSeries(), which indicates that the problem is directly related to static variable management. But I just can't get to the bottom of it.
Below is the code and log output I sent Norgate for two simple watchlists (one with a delisted symbol, the other without) to illustrate the problem.
Thanks,
Robert
#include_once "Formulas\Norgate Data\Norgate Data Functions.afl"
// --- Get symbol list ---
wlnumber = GetOption( "FilterIncludeWatchlist" );
list = CategoryGetSymbols(categoryWatchlist, wlnumber);
// --- Run through all symbols and save static var ---
if ( Status( "stocknum" ) == 0 )
{
StaticVarRemove("*");
for ( n = 0; ( Symbol = StrExtract( list, n ) ) != ""; n++ )
{
SetForeign( Symbol );
For_IsInNDX = Nz(NorgateIndexConstituentTimeSeriesOther("$NDX", Symbol), 0);
StaticVarSet("For_IsInNDX" + Symbol, For_IsInNDX);
RestorePriceArrays();
}
}
IsInNDX = NorgateIndexConstituentTimeSeries("$NDX");
For_IsInNDX = StaticVarGet("For_IsInNDX" + Name());
// --- Compare ---
Sum_Is = Sum(IsInNDX, BarCount);
Sum_For_Is = Sum(For_IsInNDX, BarCount);
_TRACE(Name() + " " + NumToStr(Sum_Is,0) + " " + NumToStr(Sum_For_Is,0));
Filter = 1;
if ( Status( "actionex" ) == actionExplore )
{
AddColumn(IsInNDX, "InNDX", 1.0);
AddColumn(For_IsInNDX, "F_NDX", 1.0);
}
Log window explore output for watchlist DTV-201507,EXPE,ZM (date range 1/1/2015 - 8/26/2022)
DTV-201507 1822 1822
EXPE 3524 2265
ZM 586 {EMPTY}
Log window explore output for watchlist EXPE,ZM
EXPE 3524 3524
ZM 586 586