Posted By: SBGuy
Assets variable contain invalid asset/symbols - 06/07/21 16:18
I've been doing this for the past several years to loop through valid symbols from my assetList files.
for(i=0; Assets[i]; i++) { asset(Assets[i]); }
or
while(loop(Assets)) { asset(Loop1]); }
Recently I noticed that bad symbols in the assetList are replaced with 1 prior valid symbol when Zorro constructs the Assets variable, causing a duplicate entry in Assets. Support thinks I have a coding problem.
Here's the test code:
Here's the live trade log, OXY is duplicated in the Assets symbol list.
==========================
Load XOM prices.. 26+300 h
Load SLB prices.. 26+300 h
Load OXY prices.. 26+300 h
!BROKERASSET: [APHA] failed... retry
Error 053: APHA unavailable at this time
Load CGC prices.. 26+300 h.
Load RIOT prices.. 26+300 h
....
[302: Mon 21-06-07 16:03] (61.12)
[0/7]-----[XOM] 61.12 ------------
[1/7]-----[SLB] 36.00 ------------
[2/7]-----[OXY] 29.15 ------------
[3/7]-----[OXY] 29.15 ------------ <-------- was supposed to be APHA
[4/7]-----[CGC] 25.61 ------------
[5/7]-----[OSTK] 93.76 ------------
[6/7]-----[RIOT] 28.73 ------------
for(i=0; Assets[i]; i++) { asset(Assets[i]); }
or
while(loop(Assets)) { asset(Loop1]); }
Recently I noticed that bad symbols in the assetList are replaced with 1 prior valid symbol when Zorro constructs the Assets variable, causing a duplicate entry in Assets. Support thinks I have a coding problem.
Here's the test code:
Code
void run() { set(PLOTNOW|LOGFILE); set(PRELOAD); StartDate = NOW; LookBack = 250; SaveMode = 0; BarPeriod = 1440; BarZone = ET; EndWeek = 52300; //UTC Time, 2300 to get past DST BarOffset=15*60+45; //3:45PM ET StartMarket = 1000; //ET Time EndMarket = 1600; //ET Time BarMode = BR_WEEKEND + BR_MARKET + BR_LEISURE + BR_SLEEP; TickTime = 1*30*1000; TockTime = 1*30*1000; int anum = assetList("Assets-TEST"); int i; if (!is(LOOKBACK)) printf("\n"); for(i=0; Assets[i]; i++) { asset(Assets[i]); if (!is(LOOKBACK)) printf("[%d/%d]-----[%s] %.2f ------------\n", i, NumAssetsListed, Asset, priceClose()); } }
Here's the live trade log, OXY is duplicated in the Assets symbol list.
==========================
Load XOM prices.. 26+300 h
Load SLB prices.. 26+300 h
Load OXY prices.. 26+300 h
!BROKERASSET: [APHA] failed... retry
Error 053: APHA unavailable at this time
Load CGC prices.. 26+300 h.
Load RIOT prices.. 26+300 h
....
[302: Mon 21-06-07 16:03] (61.12)
[0/7]-----[XOM] 61.12 ------------
[1/7]-----[SLB] 36.00 ------------
[2/7]-----[OXY] 29.15 ------------
[3/7]-----[OXY] 29.15 ------------ <-------- was supposed to be APHA
[4/7]-----[CGC] 25.61 ------------
[5/7]-----[OSTK] 93.76 ------------
[6/7]-----[RIOT] 28.73 ------------