ccyStrength() only working for some Currencies

Posted By: Smon

ccyStrength() only working for some Currencies - 07/17/18 15:51

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.
Posted By: AndrewAMD

Re: ccyStrength() only working for some Currencies - 07/17/18 18:58

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.
Posted By: Smon

Re: ccyStrength() only working for some Currencies - 07/18/18 03:02

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.
© 2024 lite-C Forums