Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, 7th_zorro), 877 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: How to perform portfolio optimization? [Re: AndrewAMD] #482698
03/18/21 03:07
03/18/21 03:07
Joined: Feb 2017
Posts: 1,729
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,729
Chicago
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.

Required reading:
https://zorro-project.com/manual/en/asset.htm (assetList)
https://manual.zorro-project.com/fortrades.htm (for(listed_assets))

Re: How to perform portfolio optimization? [Re: antoniorenar] #482707
03/18/21 19:41
03/18/21 19:41
Joined: Mar 2021
Posts: 24
A
antoniorenar Offline OP
Newbie
antoniorenar  Offline OP
Newbie
A

Joined: Mar 2021
Posts: 24
Hello, sorry for new thread I don't understand good the platform
I have something like this
function run()
{
set(LOGFILE);
set(PARAMETERS);

StartDate=2018;
NumYears=1;

BarPeriod = 60;
LookBack = 100*5;

var TimeFactor = optimize(3,1,5,1);
var Coef = optimize(3,1,10,1);

assetList("AssetsDarwinex","EUR/USD","GBP/USD","AUD/USD");

for(listed_assets)
{
asset(Asset);

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/21 20:27.
Re: How to perform portfolio optimization? [Re: antoniorenar] #482715
03/19/21 00:42
03/19/21 00:42
Joined: Feb 2017
Posts: 1,729
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,729
Chicago
assetList() only takes one or two arguments, yet you have supplied four arguments. That's an error.

Re: How to perform portfolio optimization? [Re: AndrewAMD] #482718
03/19/21 02:11
03/19/21 02:11
Joined: Mar 2021
Posts: 24
A
antoniorenar Offline OP
Newbie
antoniorenar  Offline OP
Newbie
A

Joined: Mar 2021
Posts: 24
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.

Thank you very much in advance, Andrew.

function run()
{
set(LOGFILE);
set(PARAMETERS);

BarPeriod = 60;
LookBack = 151;

var TimeFactor = optimize(3,1,5,1);

assetList("AssetsDarwinex","EUR/USD","GBP/USD"/*,"AUD/USD"*/);

for(listed_assets)
{
asset(Asset);

vars Price = series(price(0));
vars MA1 = series(SMA(Price,30));
vars MA2 = series(SMA(Price,30*TimeFactor));

Stop = 3*ATR(10);

if(crossOver(MA1,MA2))
enterLong();
else if(crossUnder(MA1,MA2))
enterShort();
}
}

Attached Files
FOR ANDREW.txt (109 downloads)
Re: How to perform portfolio optimization? [Re: antoniorenar] #482727
03/19/21 18:49
03/19/21 18:49
Joined: Feb 2017
Posts: 1,729
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,729
Chicago
assetList("AssetsDarwinex","EUR/USD","GBP/USD"/*,"AUD/USD"*/);

Let's count the parameters:
one: "AssetsDarwinex"
two: "EUR/USD"
three: "GBP/USD"/*
four: "AUD/USD"*/

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.

Try it.

Re: How to perform portfolio optimization? [Re: AndrewAMD] #482733
03/19/21 22:17
03/19/21 22:17
Joined: Mar 2021
Posts: 24
A
antoniorenar Offline OP
Newbie
antoniorenar  Offline OP
Newbie
A

Joined: Mar 2021
Posts: 24
Now I understand you, Andrew!

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.

Thank you VERY MUCH, Andrew!!!

Page 2 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1