Add AUX1 and AUX2 Fields using AFL

Hi,

I’d like to add certain calculations that take a lot of time to calculate…I’m using AddToComposite for this purpose but that has resulted in doubling the symbols in my database and I need to use Foreign always to retreive those metrics.

The Workaround would be ripping it to csv and Importing backk…is that the only way ?

Please let me know…

Vikas

Alternative to AddToComposite is StaticVarAdd
https://www.amibroker.com/guide/afl/staticvaradd.html

…which is also generally faster :wink:

But i would like to add in Aux fields as static variables are erased from memory

Wrong!

Have you actually read the link carefully?
Have you read about persistency setting?
Obviously not.

BTW, persistency setting is part of all static var functions!
So if you would have clicked the further links at the bottom of staticvaradd link there then you would have come to here https://www.amibroker.com/guide/afl/staticvarset.html for example and would have read more about persistency setting.

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 );

As noted static variables are generally better idea, but to answer original question you can use “1” and “2” in AddToComposite field to write to Aux1 and Aux2.
It is documented in the manual: http://www.amibroker.com/guide/afl/addtocomposite.html

1 Like

perfect…got that…