|
2 registered members (Imhotep, opm),
785
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
sub group backtesting
#484217
09/22/21 04:39
09/22/21 04:39
|
Joined: Oct 2018
Posts: 82
7th_zorro
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2018
Posts: 82
|
Hello.
Does series() function must be called every assets even if some assets does not traded some period of time?
For example,
If I want trade 1,000 assets, I want to test every year with different asset group.
But zorro forced to calculate all assets even though the assets does not trade that specific year.
As a result, backtesting time increased unrealistically.
How to avoid this problem?
I want to test different sub group at every years.
Last edited by 7th_zorro; 09/22/21 04:43.
|
|
|
Re: sub group backtesting
[Re: 7th_zorro]
#484218
09/22/21 08:37
09/22/21 08:37
|
Joined: Aug 2017
Posts: 294 Netherlands
Grant
Member
|
Member
Joined: Aug 2017
Posts: 294
Netherlands
|
You can run the series() function after a condition like: if(priceClose() > 0)... etc
Last edited by Grant; 09/22/21 08:37.
|
|
|
Re: sub group backtesting
[Re: Grant]
#484220
09/22/21 08:44
09/22/21 08:44
|
Joined: Oct 2018
Posts: 82
7th_zorro
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2018
Posts: 82
|
No, That's not work. It causes error while training or some other calculation like bolinger band. Can't select sub assets group, always must calculate all assets.
Last edited by 7th_zorro; 09/22/21 08:56.
|
|
|
Re: sub group backtesting
[Re: Grant]
#484226
09/22/21 23:20
09/22/21 23:20
|
Joined: Oct 2018
Posts: 82
7th_zorro
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2018
Posts: 82
|
Suppose I have 1,000 assets in assets list. What I want to do is to calculate the trading signals for only different 100 assets in each year, not all assets. Definitly while(asset(loop(Assets))) is not the right solution. Because it loops all assets. Picking sub assets in while loop cause error. (don't know why, maybe someone can explain this? I suspect all assets need sync.) How can I solve this?
Last edited by 7th_zorro; 09/22/21 23:33.
|
|
|
Re: sub group backtesting
[Re: 7th_zorro]
#484227
09/23/21 07:08
09/23/21 07:08
|
Joined: Aug 2017
Posts: 294 Netherlands
Grant
Member
|
Member
Joined: Aug 2017
Posts: 294
Netherlands
|
What might work, is hardcoding your list of assets by working with a loop & switch-statement. Something like: int i;
function run()
{
if(is(INITRUN))
{
asset("A");
asset("B");
asset("C");
}
for(i = 0; 1<= 2; i++)
{
switch(i)
{
case 0:
asset("A");
break;
case 1:
asset("B");
break;
case 2:
asset("C");
break;
}
}
quit();
} You can use a spreadsheet to convert your asset list into code.
|
|
|
Re: sub group backtesting
[Re: Grant]
#484229
09/23/21 11:21
09/23/21 11:21
|
Joined: Oct 2018
Posts: 82
7th_zorro
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2018
Posts: 82
|
This cause the following error. What's wrong in this codes? "Error 041: Wrong series usage!"
function run()
{
BarPeriod = 1440;
if(is(INITRUN))
{
History = ........;
assetList(......, 0);
asset("A");
asset("B");
asset("C");
}
if(dow() == 1)
{
asset("A");
vars price = series(priceClose());
}
else if(dow() == 2)
{
asset("B");
vars price = series(priceClose());
}
else if(dow() == 3)
{
asset("C");
vars price = series(priceClose());
}
else if(dow() == 4)
{
asset("A");
vars price1 = series(priceClose());
asset("B");
vars price2 = series(priceClose());
asset("C");
vars price3 = series(priceClose());
}
}
|
|
|
Re: sub group backtesting
[Re: AndrewAMD]
#484231
09/23/21 13:43
09/23/21 13:43
|
Joined: Oct 2018
Posts: 82
7th_zorro
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2018
Posts: 82
|
So, my question is how to handle assets with sub-groups if I have 1,000 assets? Need to calculate every assets at every bar even though some of them only used?
Last edited by 7th_zorro; 09/23/21 14:11.
|
|
|
|
|
|