creating an Asset list from control panel

Posted By: SBGuy

creating an Asset list from control panel - 08/02/18 22:40

I currently hardcoded my multi-asset strategy like this:

while (asset(loop("AAPL", "MSFT", GOOG")))
{
strategy....
}

What's the best way to get a user-defined list of assets from a control panel(), so I can change the asset list on the fly?

Do I simply make a string array from the panel inputs, then use a for loop like this?

Code:
void run()
{
    get panel asset entries into MyAssets[N] array;

    for (i=0; MyAssets[i]; i++)
    {
        asset(MyAssets[i]);
        strategy..
    } 
}







Posted By: jcl

Re: creating an Asset list from control panel - 08/03/18 14:57

Yes. Make sure that you do that in the first run, because assets can't be added in later runs.
Posted By: SBGuy

Re: creating an Asset list from control panel - 08/03/18 18:26

Oh.. so in live trading, I have to Stop, change the assets list, then Train, and Trade again? Maybe this doesn't work in a way that I was envisioning.

I was thinking of writing a multi-asset portfolio strategy, with the ability to swap out assets on the fly using a control panel, without resetting the portfolio performance metrics like P&L, win rate, etc.

Is this possible? Or am I just better off running a single asset strategy on multiple instances of Zorro S, then doing portfolio analysis manually an offline?
Posted By: AndrewAMD

Re: creating an Asset list from control panel - 08/03/18 20:30

You can also have a complete Asset list and train them all, and then cherry-pick your Assets with the GUI.

How you program this depends on your goals.
Posted By: SBGuy

Re: creating an Asset list from control panel - 08/03/18 23:45

The only way to do this is put all 4,000+ US stocks into the AssetList, and create indicators for them on every run() :-) As soon as I like one stock that isn't one my AssetList, I'm back to the same problem :-(

But you're right, if my asset list is like 20, but only cherry pick 4-5 at a time, then its probably doable.
© 2024 lite-C Forums