I was using Amibroker version 6.40.4 X64 until this morning and everything was working fine as of this morning.
This morning, I have upgraded Amibroker to version 6.90.1 X64.
I have a batch file in which I set static variable in the first script and get the static variable in the subsequent scripts so that only scripts that have data as of the date of index are returned.
if (Status("stocknum") == 0){
if (GetDatabaseName() == "InEOD-DhanHQ"){
StaticVarRemove("InEOD-DhanHQ-LTD");
SetForeign("NIFTY 50");
dt = DateNum();
ltd = LastValue(dt);
//LTD stands for last trade date in DateNum format
StaticVarSet("InEOD-DhanHQ-LTD", ltd, persist = True);
RestorePriceArrays();
}
if (GetDatabaseName() == "USEOD-Polygon"){
StaticVarRemove("USEOD-Polygon-LTD");
SetForeign("SPY");
dt = DateNum();
ltd = LastValue(dt);
//LTD stands for last trade date in DateNum format
StaticVarSet("USEOD-Polygon-LTD", ltd, persist = True);
RestorePriceArrays();
}
}
When I run the above script in AFL editor and immediately execute the next script (see below) in batch file from AFL editor using the analysis window, I am getting results as expected.
//Get tickers whose last traded Date is same as index last traded date
if (GetDatabaseName() == "InEOD-DhanHQ"){
dn_index_lastdataDate = StaticVarGet("InEOD-DhanHQ-LTD");
}
else if (GetDatabaseName() == "USEOD-Polygon"){
dn_index_lastdataDate = StaticVarGet("USEOD-Polygon-LTD");
}
dt_index_lastdataDate = DateTimeConvert(2, dn_index_lastdataDate);
symbol = Name();
dt = DateTime();
dt_symbol_lastdataDate = LastValue(dt);
iscurrentdate = DateTimeDiff(dt_index_lastdataDate, dt_symbol_lastdataDate) == 0;
//filtering the data
if (StrFind(GetDatabaseName(), "USEOD")){
Filter = ROC(Close, 21) > 20 AND Close > 5 AND LLV(Volume, 10) > 100000 AND iscurrentdate;
}
else if (StrFind(GetDatabaseName(), "InEOD")){
Filter = ROC(Close, 21) > 20 AND Close > 5 AND LLV(Volume, 10) > 10000 AND iscurrentdate;
}
AddColumn(Close, "Close", 1.2);
AddColumn(ROC(C, 21), NumToStr(21, 1.0)+" DPerf", 1.2);
AddColumn(dt_index_lastdataDate, "Index Last Date", formatDateTime);
AddColumn(dt_symbol_lastdataDate, "Symbol Last Date", formatDateTime);
AddColumn(DateTimeDiff(dt_index_lastdataDate, dt_symbol_lastdataDate)/(24*3600), "Date Difference", 1.0);
SetSortColumns(4);
When I make a batch file and run the 2 scripts in sequence, I dont get any results as the date is being set to previous bar date.
This started happening after the upgrade. After trying all the methods I can, I have downgraded back to my original version but the issue still persists.
I made a small youtube video explaining the issue: https://youtu.be/wxfa1o0Wkco
Please advise how this issue can be resolved as I am not able to run any of my scripts.