Gamestudio Links
Zorro Links
Newest Posts
How was this Game Rendered?
by 3run. 08/06/20 20:01
problem with adding new history
by daan. 08/06/20 19:53
wrong Entry
by daan. 08/06/20 19:52
New Zorro version 2.30
by Zheka. 08/06/20 17:40
Lookback period - no signs of live
by jcl. 08/06/20 16:23
How to plot stop TradeStopLimit
by AdamWu. 08/06/20 15:03
Chat Room for Zorro Programmers
by AdamWu. 08/06/20 14:20
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
10 registered members (AdamWu, Dooley, daan, Zheka, jenGs, painkiller, AndrewAMD, Aweys, 3run, 1 invisible), 477 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
bigimpactsound, tzw101, Al82, Alibert, jsch
18489 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: 102
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 102
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,307
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,307
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: 102
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 102
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: 102
S
SBGuy Offline OP
Member
SBGuy  Offline OP
Member
S

Joined: May 2018
Posts: 102
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: 24
A
AdamWu Online
Newbie
AdamWu  Online
Newbie
A

Joined: May 2020
Posts: 24
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: 24
A
AdamWu Online
Newbie
AdamWu  Online
Newbie
A

Joined: May 2020
Posts: 24
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: 24
A
AdamWu Online
Newbie
AdamWu  Online
Newbie
A

Joined: May 2020
Posts: 24
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);
	}
}


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