Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 744 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Zorro's plotChart() correct usage ? #487440
04/23/23 14:36
04/23/23 14:36
Joined: Dec 2021
Posts: 12
Z
Zendrix Offline OP
Newbie
Zendrix  Offline OP
Newbie
Z

Joined: Dec 2021
Posts: 12
Hello everybody,
I am trying to make Zorro handing out proper .png files. Using a simple script to have a plotting on hand :

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

function run()
{
	//set(PLOTNOW);
	setf(PlotMode,PL_FINE|PL_FILE|PL_LONG);
	PlotWidth = 1000;
	PlotHeight1 = 500;
	PlotHeight2 = 500;
	StartDate = 20220101;
	EndDate = 20230401;
	BarPeriod = 1440;                 // Stooq EOD
	LookBack = 100;
	
	//My Asset File
	assetList("C:\\Zorro\\History-stooq-EOD\\assetlist-stooq-EOD.csv","PFE"); 

	int cnt = 0;
	int i;


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

	i = 2;                               //switching asset to asset_No like to plot...
	asset(Assets[i]);   
	assetSelect();
	
	
	plot(strf("Cl for %s",Assets[i]),Prices[i],NEW,RED);
	plot(strf("SMA for %s",Assets[i]),smas[i],0,BLUE);			
			

}


Compiling, pressing "Test" - no errors.
Then pressing "Result" (as PL_FILE is set), Z Chart Viewer opens and presents the requested plotting : attached AAAA.png great !!

BUT by adding plotChart() to my script ...

Zorros Manual :
Quote

Generates a chart or histogram from the previous plot calls, and displays it with the chart viewer or stores it in a .png file with the given FileName when PL_FILE is set. Exports it to a CSV file when PL_EXPORT is set. Deletes all plot elements so that new plots can be built afterwards. Use this function to update charts or histograms in real time (see PayOff.c). If this function is not used, the chart is generated at the end of a backtest or when clicking [Result].




Code



	i = 2;                             
	asset(Assets[i]);   
	assetSelect();
	
	
	plot(strf("Cl for %s",Assets[i]),Prices[i],NEW,RED);
	plot(strf("SMA for %s",Assets[i]),smas[i],0,BLUE);			
			
        plotChart(strf("C:\\Users\\jhxm\\Desktop\\test-%s.png",Assets[i]));   //  << ==============================

}


...the script takes ages to run, and then presents a file with missing 50% of plotting.
Yes, it correctly just writes the file as .png to the desktop and does not open the viewer, but!! half of the plotting is missing.

Datasource is/are local .t6 EOD files, there should be no problem with catching the plotting datas at speed.

So I guess, I am using the plotChart() command in wrong manner.
Did somebody solve this problem already or can provide a guide how to correctly use plotChart ?

Best Regards
Hendrix

Attached Files
AAAA.png (27 downloads)
test-MRK.png (27 downloads)
Re: Zorro's plotChart() correct usage ? [Re: Zendrix] #487445
04/26/23 13:57
04/26/23 13:57
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
It takes ages because you're plotting a chart at any bar. Also, plotting is asset specific. Use assetSelect() to determine the asset to plot.


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