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
3 registered members (Edgar_Herrera, VoroneTZ, Akow), 973 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
multiple results graph in multi-asset scripts? #473236
06/22/18 19:19
06/22/18 19:19
Joined: May 2018
Posts: 134
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 134
Is there a way to generate multiple result graphs/plots when in a multi-asset script?

My multi-asset script only plots the last asset.


Last edited by SBGuy; 06/22/18 19:19.
Re: multiple results graph in multi-asset scripts? [Re: SBGuy] #473379
07/02/18 09:55
07/02/18 09:55
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Look for "PlotMode" in the manual, there you can set a multi-asset mode.

Re: multiple results graph in multi-asset scripts? [Re: jcl] #473399
07/02/18 23:31
07/02/18 23:31
Joined: May 2018
Posts: 134
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 134
Doesn't quite do what I was hoping for. PlotMode PL_ALL just mashes the graphs together making them not legible. I was hoping for neat single asset result plot that I can use to analyze and debug.

Looks like I'll have to do one asset a time for this.

Thanks.

Re: multiple results graph in multi-asset scripts? [Re: SBGuy] #473400
07/03/18 02:32
07/03/18 02:32
Joined: Sep 2017
Posts: 235
H
Hredot Offline
Member
Hredot  Offline
Member
H

Joined: Sep 2017
Posts: 235
If you have all the asset price curves and let's say SMAs saved in different globally defined series, there is nothing stopping you from doing something like

Code:
int cnt=0;
while(loop(Assets)){
    asset(Loop1);
    Prices[cnt]=series(price());
    smas[cnt]  =series(SMA(Prices[cnt],10));
    cnt++;
}
asset(Assets[0]);
PlotWidth = 600;
PlotHeight1 = 500;
PlotHeight2 = 500;
int i;
for(i=0;i<cnt;i++){
    plot(strf("%s",Assets[i]),Prices[cnt],NEW,BLACK);
    plot(strf("sma for %s",Assets[i]),smas[cnt],0,BLUE);
    ...plot more stuff...
}



to plot all of them in separate graphs.

Last edited by Hredot; 07/03/18 02:37.
Re: multiple results graph in multi-asset scripts? [Re: Hredot] #473414
07/03/18 17:39
07/03/18 17:39
Joined: May 2018
Posts: 134
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 134
I see. Thanks for the tip Hredot.

Re: multiple results graph in multi-asset scripts? [Re: Hredot] #480788
07/13/20 13:27
07/13/20 13:27
Joined: May 2020
Posts: 45
A
AdamWu Offline
Newbie
AdamWu  Offline
Newbie
A

Joined: May 2020
Posts: 45
Hi Hredot, I am new to Zorro and I can not run your code. It complained about Prices and smas undefined and some other errors. So I canged the code to:
Code
function run() 
{
	StartDate = 20200710; 
	// My Assets File
	assetList("AssetsFXCMLite");
	int cnt=0;
	vars Prices[10];
	vars smas[10];
	BarPeriod = 1440;
	while(loop(Assets)){
		//printf("\n%s", Loop1);
		//asset(Loop1);
		Prices[cnt] = series(priceClose());
		smas[cnt] = series(SMA(Prices[cnt],10));
		cnt++;
	}
	asset(Assets[0]);
	PlotWidth = 600;
	PlotHeight1 = 500;
	PlotHeight2 = 500;
	int i;
	print("\n*************** %d",cnt);
	for(i=0;i<cnt;i++){
		plot(strf("%s",Assets[i]),Prices[i],NEW,BLACK);
		plot(strf("sma for %s",Assets[i]),smas[i],0,BLUE);
	}
}


Now there is no errors. But the plots are the same. (See bellow). Can you give me a clue?
[Linked Image]

Last edited by AdamWu; 07/13/20 14:39.
Re: multiple results graph in multi-asset scripts? [Re: SBGuy] #480789
07/13/20 13:28
07/13/20 13:28
Joined: May 2020
Posts: 45
A
AdamWu Offline
Newbie
AdamWu  Offline
Newbie
A

Joined: May 2020
Posts: 45
Originally Posted by SBGuy
I see. Thanks for the tip Hredot.

Can I have look of your code, thansks.

Re: multiple results graph in multi-asset scripts? [Re: SBGuy] #480791
07/13/20 14:53
07/13/20 14:53
Joined: May 2020
Posts: 45
A
AdamWu Offline
Newbie
AdamWu  Offline
Newbie
A

Joined: May 2020
Posts: 45
Never mind I find a way to do so:
Code
vars Prices[3];
vars smas[3];
function run() 
{
	StartDate = 20200710; 
	// My Assets File
	assetList("AssetsFXCMLite");
	int cnt=0;
	BarPeriod = 1440;
	while(loop(Assets)){
		asset(Loop1);
		Prices[cnt] = series(priceClose());
		smas[cnt] = series(SMA(Prices[cnt],10));
		cnt++;
	}
	asset(Assets[0]);
	PlotWidth = 600;
	PlotHeight1 = 500;
	PlotHeight2 = 500;
	int i;
	for(i=0;i<cnt;i++){
		plot(strf("%s",Assets[i]),Prices[i],NEW,BLACK);
		plot(strf("sma for %s",Assets[i]),smas[i],0,BLUE);
	}
}

Re: multiple results graph in multi-asset scripts? [Re: SBGuy] #487426
04/14/23 10:16
04/14/23 10:16
Joined: Apr 2023
Posts: 3
E
Enivant Offline
Guest
Enivant  Offline
Guest
E

Joined: Apr 2023
Posts: 3
Only cleaned up your code, it works fine (unfortunately it seems to not be possible to plot candles in all charts: "Candles and bands are only plotted in the main chart."
see https://zorro-project.com/manual/en/plot.htm)):

Code


Code
vars Prices[0];
vars smas[0];

function run()
{
	set(PLOTNOW);
	PlotWidth = 600;
	PlotHeight1 = 500;
	PlotHeight2 = 500;
	StartDate = 20220101;
	EndDate = 20220205;
	BarPeriod = 1440;
	//My Asset File
	assetList("AssetsXY"); 

	int cnt = 0;
	int i;


	//while(loop(Assets))
	while(asset(loop(Assets)))
	{
			Prices[cnt] = series(priceClose());
			smas[cnt] = series(SMA(Prices[cnt],10));
			cnt++;
	}

	asset(Assets[0]);

	for(i=0;i<cnt;i++)
	{
			plot(strf("Cl for %s",Assets[i]),Prices[i],NEW,BLACK);
			plot(strf("SMA for %s",Assets[i]),smas[i],0,BLUE);
	}
	
}



Attached Files
Last edited by Enivant; 04/14/23 11:49.

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1