4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to perform portfolio optimization?
#482678
03/16/21 20:08
03/16/21 20:08
|
Joined: Mar 2021
Posts: 24
antoniorenar
OP
Newbie
|
OP
Newbie
Joined: Mar 2021
Posts: 24
|
Good afternoon, I am new in zorro, I am trying to optimize my system on multiple symbols and that single set of parameters for all symbols but at the moment it throws me a set of parameter for each symbol that I optimize, someone who does the same could give me a hint
Last edited by antoniorenar; 03/16/21 21:05.
|
|
|
Re: How to perform portfolio optimization?
[Re: antoniorenar]
#482680
03/16/21 21:04
03/16/21 21:04
|
Joined: Mar 2021
Posts: 24
antoniorenar
OP
Newbie
|
OP
Newbie
Joined: Mar 2021
Posts: 24
|
I want to optimize my system in several markets at the same time, and that the optimizer looks for a single set of parameters for all markets not one for each can you show me some code? Thanks for your answer
Last edited by antoniorenar; 03/16/21 21:05.
|
|
|
Re: How to perform portfolio optimization?
[Re: antoniorenar]
#482684
03/17/21 00:20
03/17/21 00:20
|
Joined: Mar 2021
Posts: 24
antoniorenar
OP
Newbie
|
OP
Newbie
Joined: Mar 2021
Posts: 24
|
For instance, the algorithm below optimizes a couple of parameters (TimeFactor and Coef) in the EUR/USD, GBP/USD and AUD/USD symbols. As a result, the best couple of parameters is 3.45 and 2.90 in EUR/USD, 3.64 and 8.01 in GBP/USD, and 3.59 and 8.10 in AUD/USD. However, if my code would run as I want, we would obtain the same parameters for the 3 symbols (for example, 3.5 and 5 for EUR/USD, GBP/USD and AUD/USD markets). This is an example of multi-symbol algorithm. In this way the optimization look for the same set of parameter for different markets in order to get the best trading results combining the same algorithm with the same parameters in different markets.
function run() { set(LOGFILE); set(PARAMETERS); StartDate=2018; NumYears=1; BarPeriod = 60; LookBack = 100*5; while( asset( loop("EUR/USD","GBP/USD","AUD/USD") ) ) { var TimeFactor = optimize(3,1,5,1); var Coef = optimize(3,1,10,1); 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(); } }
|
|
|
Re: How to perform portfolio optimization?
[Re: antoniorenar]
#482692
03/17/21 17:08
03/17/21 17:08
|
Joined: Mar 2021
Posts: 24
antoniorenar
OP
Newbie
|
OP
Newbie
Joined: Mar 2021
Posts: 24
|
I try whit this code, nevertheless it keeps throwing me 6 parameters Could you help me correcting the fragment and sending it to me?
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); while( asset( loop("EUR/USD","GBP/USD","AUD/USD") ) ) { 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(); } }
Thanks a lot for your time, I hope to reward you
|
|
|
Re: How to perform portfolio optimization?
[Re: antoniorenar]
#482696
03/17/21 23:54
03/17/21 23:54
|
Joined: Mar 2021
Posts: 24
antoniorenar
OP
Newbie
|
OP
Newbie
Joined: Mar 2021
Posts: 24
|
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);
while( asset( loop("EUR/USD","GBP/USD","AUD/USD") ) ) { 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(); } }
|
|
|
|