|
3 registered members (TipmyPip, AndrewAMD, Quad),
5,062
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Optimize in a ranked asset portfolio
#481711
10/20/20 18:09
10/20/20 18:09
|
Joined: Jan 2017
Posts: 19 Israel
dBc
OP
Newbie
|
OP
Newbie
Joined: Jan 2017
Posts: 19
Israel
|
I'm trying to implement in Zorro this R code provided in this site: IGM strategyThe code looks like this:
vars Returns[6];
var cumRets[6];
int days = 0;
function run()
{
// set(PARAMETERS+LOGFILE+PLOTNOW);
set(LOGFILE+PLOTNOW);
BarPeriod = 1440;
LookBack = 240;
Verbose = 0;
NumWFOCycles = 5;
int i;
for(i=0;i<6;i++)
{
asset(Assets[i]);
Returns[i] = series((price(0)-price(1))/price(1));
}
days++;
if (days%20 == 0 && days>240) { // once a month do
exitTrade();
while(asset(loop("MDY", "TLT", "EEM", "ILF", "EPP", "FEZ")))
{
vars retSubset = Returns[Itor1];
cumRets[Itor1] = Sum(retSubset,optimize(60,20,240,20));
}
int * Idx = sortIdx (cumRets, -6);
// printf("\n %i", Idx[0]);
asset(Assets[Idx[0]]);
enterLong();
}
}
The TEST phase works correctly, but the TRAIN phase optimize the last asset only, then the TEST issue an error that no .par file is available for each asset. The manual explains that the TRAIN runs each asset with all available parameters value, then continue to the next asset. In this specific strategy the position is taken only after all assets are ranked by their returns, in my understanding the current TEST approach can't handle such situation. Am I correct or there is some hack to overcome this situation?
|
|
|
Re: Optimize in a ranked asset portfolio
[Re: dBc]
#481720
10/22/20 06:25
10/22/20 06:25
|
Joined: Jan 2017
Posts: 19 Israel
dBc
OP
Newbie
|
OP
Newbie
Joined: Jan 2017
Posts: 19
Israel
|
I'm using while(asset(loop... optimize( ... If I use asset - loop to calculate the returns, I got the same results, no optimization is made.
Last edited by dBc; 10/22/20 06:58.
|
|
|
Re: Optimize in a ranked asset portfolio
[Re: dBc]
#481735
10/24/20 18:15
10/24/20 18:15
|
Joined: Mar 2019
Posts: 357
danatrader
Senior Member
|
Senior Member
Joined: Mar 2019
Posts: 357
|
I am sorry, may you explain in different words?
You say, "It seems that Zorro's optimization algorithm optimizes each asset separately."
Then you state, "In a horizontal optimization one would end with different parameter values for each asset."
Isn't that contradicting? Then again, with beta 2.33 you can use R-Code for optimization.
Last edited by danatrader; 10/24/20 18:15.
|
|
|
|