Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Imhotep, opm), 785 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
sub group backtesting #484217
09/22/21 04:39
09/22/21 04:39
Joined: Oct 2018
Posts: 82
7
7th_zorro Offline OP
Junior Member
7th_zorro  Offline OP
Junior Member
7

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
G
Grant Offline
Member
Grant  Offline
Member
G

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
7
7th_zorro Offline OP
Junior Member
7th_zorro  Offline OP
Junior Member
7

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: 7th_zorro] #484223
09/22/21 13:46
09/22/21 13:46
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
So, first you need to calculate the trading signals for all assets, correct? 1,000 assets is obviously a lot for a back test.

Maybe you can post your code to see which parts can be streamlined?

Re: sub group backtesting [Re: Grant] #484226
09/22/21 23:20
09/22/21 23:20
Joined: Oct 2018
Posts: 82
7
7th_zorro Offline OP
Junior Member
7th_zorro  Offline OP
Junior Member
7

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
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
What might work, is hardcoding your list of assets by working with a loop & switch-statement.
Something like:

Code
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
7
7th_zorro Offline OP
Junior Member
7th_zorro  Offline OP
Junior Member
7

Joined: Oct 2018
Posts: 82
This cause the following error. What's wrong in this codes?
"Error 041: Wrong series usage!"

Code
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: 7th_zorro] #484230
09/23/21 13:35
09/23/21 13:35
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Never bury series calls in an if else statement! You must call series() the exact same number of times every time run is called.

Here, run might call series 0, 1, or 3 times, which is wrong.

Re: sub group backtesting [Re: AndrewAMD] #484231
09/23/21 13:43
09/23/21 13:43
Joined: Oct 2018
Posts: 82
7
7th_zorro Offline OP
Junior Member
7th_zorro  Offline OP
Junior Member
7

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.
Re: sub group backtesting [Re: 7th_zorro] #484244
09/24/21 23:00
09/24/21 23:00
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Do you know in advance which assets you want to run during specified periods? If so, then I would suggest to run those blocks between date a & b, c & d, e & f, etc... By doing so there are no gaps like Andrew mentioned.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1