I will try the other way around. Of course I read the manual (as I mentioned previously), but these function calls are not fully defined.
As for two loops, I don't see how else this could possibly be done? I need an indicator which is calculated over all assets, so presumably I need a loop to define the indicator. The indicator must be defined before the advise calls which are done in a second loop.
Thanks, I will check if divide by zero could be happening, but I still don't understand the difference between for(listed_assets) and for(used_assets) after reading the manual.