Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,135 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
series issue? #428218
08/21/13 02:55
08/21/13 02:55
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi. Please run this code for EUR/USD:

Code:
function run() {
	set(LOGFILE);
	StartDate	= 20130101;
	EndDate		= 20130131;
	vars	Price = series(price());
	vars	Trend	= series(LowPass(Price,1000));
	printf("\nBar,Price0-5=%i,%10.f4,%10.4f,%10.4f,%10.4f,%10.4f,%10.4f",Bar,Price[0],Price[1],Price[2],Price[3],Price[4],Price[5]);
	printf("\nBar,Trend0-5=%i,%10.f4,%10.4f,%10.4f,%10.4f,%10.4f,%10.4f",Bar,Trend[0],Trend[1],Trend[2],Trend[3],Trend[4],Trend[5]);
}



Is the [0] = Current Bar value for both Price and Trend supposed to be 14? That doesn't seem to be what the manual says, and it doesn't carry over to the [1] value of the next bar...

If this is correct, please help me understand.

Thanks.

Re: series issue? [Re: DdlV] #428224
08/21/13 09:40
08/21/13 09:40
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I'm fowarding this as a little puzzle to the Zorro users. Who can help DdlV and explain why both price and trend are 14 and don't carry over?

Solution tomorrow.

Hint: you need not run the script.

Re: series issue? [Re: jcl] #428225
08/21/13 09:49
08/21/13 09:49
Joined: Oct 2012
Posts: 48
C
Chaosfreak Offline
Newbie
Chaosfreak  Offline
Newbie
C

Joined: Oct 2012
Posts: 48
Hi DdIV,

Looks like a typo in the format string for the second argument. You wrote "%10.f4" but it has to be "%10.4f". It's always 14 because "0.f" is just replaced with nothing by printf and 14 remains, or am I wrong (Didn't run the code :))?

Last edited by Chaosfreak; 08/21/13 09:53.
Re: series issue? [Re: Chaosfreak] #428230
08/21/13 12:11
08/21/13 12:11
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks jcl, Chaosfreak! *moreeggonface* Yes, it was that hard-to-notice typo. I think the exact explanation is that %10.f4 splits as %10.f for the value format and "4" remains as text. The %10.f formats the 1.xxxx value as "1", which plus the "4" gives the "14".

Back to typing/proofreading/dyslexic/whatever school... frown

Thanks.

Re: series issue? [Re: DdlV] #428233
08/21/13 12:56
08/21/13 12:56
Joined: Oct 2012
Posts: 48
C
Chaosfreak Offline
Newbie
Chaosfreak  Offline
Newbie
C

Joined: Oct 2012
Posts: 48
Yes, that's the correct explanation. This printf stuff always confusing me crazy


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