Why did you start a different thread with the same name and a slightly different question?
More importantly, why didn't you attempt to do what I said? Please review:
Originally Posted by AndrewAMD
I forgot to mention - you need to eliminate the loop() call. For that, you can load an asset list and use one of the asset loops instead: https://manual.zorro-project.com/fortrades.htm
Some questions: 1) Why didn't you replace the loop() call? Fix this. 2) Where is your for(listed_assets){asset(Asset); ... ... } loop? Fix this. 3) Why didn't you load an asset list? To do this, you call assetList(); Fix this.
vars Price = series(price(0)); vars MA1 = series(SMA(Price,30)); vars MA2 = series(SMA(Price,30*TimeFactor));
Stop = Coef*ATR(10);
if(crossOver(MA1,MA2)) enterLong(); else if(crossUnder(MA1,MA2)) enterShort(); } } I have an error between assetList(...) and for(listed_assets), where it is no line of code What can I do to resolve the problem? May you help me changing my code, please? My knowledge in Zorro does not allow me to advance anymore
Last edited by antoniorenar; 03/18/2120:27.
Re: How to perform portfolio optimization?
[Re: antoniorenar]
#482715 03/19/2100:4203/19/2100:42
I don't really understand anything! You told me to use assetlist() to be able to optimize in 3 or more markets. But if you now tell me that assetlist() only accepts 2 parameters, I can only work with 1 market.
Please, I beg you, if you really know how to do it, modify the code below for me (I attach you too), because I am new in Zorro and its user manual does not solve my doubts because it lacks examples.
Now, if it is not possible to do what I ask you in Zorro, tell me and I leave this trading platform immediately, because effectiveness and efficiency are fundamental for me.
The last two are garbage entries anyways. And you don't need the second one.
Let's change it to this:
assetList("AssetsDarwinex");
The assetList() call loads a csv file, named AssetsDarwinex.csv in your History folder. Make sure this CSV has only the three assets you need, and you're all set.
Therefore, your for(listed_assets) call will only load the three assets in your CSV file.
I just tried what you told me and.... it works!!! Whichever I choose externally in the market box (to the right of the script name box), I always obtain the same parameters for the 3 markets, just what I wanted.