I have a .afl file that creates/loads a static variable with a numeric value(initialized to zero).
When I execute a second .afl file, I do an 'include_once' of the first.afl file. During execution of the second file, I do a 'staticvarget' and load the value into a regular variable which is then incremented. A 'staticvarset' is executed to load the new value back into the static variable. I thought this would work, but it doesn't. Using _Trace, I can see that the initial value is retrieved and incremented from the static variable. But, the incremented value doesn't appear to be making it back into the static variable. On the second pass, the same value is pulled and incremented. Guidance will be appreciated. if (Buy[BCnt]) { PrevSig=BarsSince(Sell); CntBuys=StaticVarGet("BuyCnt"); _TRACE("CntBuys "+CntBuys); CntBuys++; StaticVarSet("BuyCnt",CntBuys); _TRACE("BuyCnt "+StaticVarGet("BuyCnt")); IIf(Close>Ref(Close,-1),UpFlag=1,DnFlag=0); } Debug output... [3556] CntBuys 0 [3556] BuyCnt 1 [3556] CntBuys 0 [3556] BuyCnt 1 [3556] CntBuys 0 [3556] BuyCnt 1