Static variable - the variable has static duration (it is allocated when the program begins and deallocated when the program ends) and initializes it to Null unless another value is specified. Static variables allow to share values between various formulas. ARRAY static variables are supported from version 5.30 and MATRIX static variables are supported from version 6.10
Persistency
Starting from version 5.80 there is a new parameter persist. If it is set to True then static variable will be stored in PersistVars.bin file when AmiBroker is closing and reloaded automatically on next startup, preserving the values of static variables between application runs). In addition to saving them automatically on exit, persistent static variables can be auto-saved at user-specified intervals using SetOption(“StaticVarAutoSave”, interval );
Gents, is there a way to manually clear/delete some of the static variables that were created during various AFL runs? I mean not from within the AFL code, but manually in the AB UI.
My code saves lots of stuff in persistent variables as they are needed to restore state after a restart. There is a set of vars for each symbol.
Especially during the testing phase it would be nice to reset everything for a symbol and start from scratch, Hence the some, as for the others I might still want to keep the current values.
Hello @zaxxon
You can name all your Static variables beginning with some prefix, and later you will be able to easily remove some or all of your Static variables (selectively) using this prefix.
Or as you ask for manual reset You can use parameters… why not?
if( ParamToggle(" Manual Remove specific StaticVars ?", "No|Yes" ) )
{
// write here all the list of the static to remove
StaticVarRemove(Prefix +"*" );
}