Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, Aku_Aku, 1 invisible), 579 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ccyStrength() only working for some Currencies #473512
07/17/18 15:51
07/17/18 15:51
Joined: Dec 2014
Posts: 206
Germany
Smon Offline OP
Member
Smon  Offline OP
Member

Joined: Dec 2014
Posts: 206
Germany
This is my code:

Code:
function run () 
{
	set(PARAMETERS+LOGFILE);
	StartDate = 20150101;
	EndDate = 20171231;
	BarPeriod = 240;
	
	ccyReset();	// reset strengths at begin of any bar
	while(asset(loop("AUDUSD","GBPUSD","USDCHF","USDCAD","EURUSD","NZDUSD","USDJPY")))
	{
	 
	 vars Prices = series(priceClose());
	 ccySet(ROC(Prices,1)); // store price change as strength
   }
	
	printf("nAUD: %.5f, CAD: %.5f, CHF: %.5f, EUR: %.5f, GBP: %.5f, JPY: %.5f, NZD: %.5f, USD: %.5f",
		ccyStrength("AUD"), ccyStrength("CAD"), ccyStrength("CHF"), ccyStrength("EUR"),
		ccyStrength("GBP"), ccyStrength("JPY"), ccyStrength("NZD"), ccyStrength("USD"));
}




And this is some example output:

AUD: -0.07003, CAD: 0.00000, CHF: 0.00000, EUR: 0.00365, GBP: 0.04370, JPY: 0.00000, NZD: -0.29004, USD: 0.01701
AUD: 0.05506, CAD: 0.00000, CHF: 0.00000, EUR: 0.26895, GBP: 0.33576, JPY: 0.00000, NZD: 0.12336, USD: -0.11208
AUD: -0.04503, CAD: 0.00000, CHF: 0.00000, EUR: -0.02909, GBP: -0.23067, JPY: 0.00000, NZD: -0.26588, USD: 0.19092
AUD: 0.90839, CAD: 0.00000, CHF: 0.00000, EUR: 1.62078, GBP: 0.83822, JPY: 0.00000, NZD: 0.59821, USD: -1.03071
AUD: -0.55427, CAD: 0.00000, CHF: 0.00000, EUR: -0.54418, GBP: -0.34425, JPY: 0.00000, NZD: -0.52226, USD: 0.39543


As you can see, some values are always zero. Looks like a bug to me...? Ich checked if something is wrong with the price data, but all seems normal.

Re: ccyStrength() only working for some Currencies [Re: Smon] #473515
07/17/18 18:58
07/17/18 18:58
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
I believe this...

"AUDUSD","GBPUSD","USDCHF","USDCAD","EURUSD","NZDUSD","USDJPY"

should be...

"AUD/USD","GBP/USD","USD/CHF","USD/CAD","EUR/USD","NZD/USD","USD/JPY"

Fix your asset list and try again.

Re: ccyStrength() only working for some Currencies [Re: AndrewAMD] #473518
07/18/18 03:02
07/18/18 03:02
Joined: Dec 2014
Posts: 206
Germany
Smon Offline OP
Member
Smon  Offline OP
Member

Joined: Dec 2014
Posts: 206
Germany
Yes, that was the problem! I didn't see what's common: All currencies showing zero values are denominators in the major pairs and have USD as numerator! Thank you! This will cause problems when the strings of the pairs are parsed.


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