Hi,
I am using the following code to save some data to persistent static variables but the variables are not ‘persisting’. When I restart Amibroker my static variables are gone. Looking in the Amibroker folder I can see that the PersistVars.bin file is not being written to when I exit Amibroker. Can anyone see a reason why the static variable wouldn’t be saving to PersistVars.bin?
Cheers,
William
odbcOpenDatabase(“ODBC;DSN=SQL_ODBC_64bit;UID=amibroker;PWD=xxxx;Trusted_Connection=No;APP=AmiBroker for Windows;WSID=xxxxx;DATABASE=StockScreens”);
if(Status(“StockNum”) == 0){
symlist = CategoryGetSymbols( categoryWatchlist, 65 );
StaticVarRemove( "GlobalRanks*" );
StaticVarRemove( "countryrankGlobalRanks*" );
countryList = ",";
for ( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ ){
SetForeign(sym);
foreignrank = odbcGetArraySQL("Select Rank, Date FROM RivkinQualityGlobal Inner Join StockInfo.dbo.StockInfo ON StockScreens.dbo.RivkinQualityGlobal.BBID = StockInfo.dbo.StockInfo.BBID WHERE StockInfo.Symbol ='"+sym+"' ORDER BY Date ASC");
foreignrank = 201 - foreignrank;
country = GetFnData("Country");
if( ! StrFind( countryList, "," + country + "," ) ) countryList += country + ",";
RestorePriceArrays();
StaticVarSet( "GlobalRanks"+ country + sym , foreignrank, True);
}
for( i = 1; ( country = StrExtract( countryList, i ) ) != ""; i++ ){
StaticVarGenerateRanks( "countryrank", "GlobalRanks" + country, 0, 1224 );
}
for ( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ ){
SetForeign(sym);
country = GetFnData("Country");
StaticVarSet("subRank",StaticVarGet( "countryrank" + "GlobalRanks" + country + sym ), True);
}
}
Buy = 0;
Sell = 0;
Short = 0;
Cover = 0;