Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Quad, VoroneTZ, 1 invisible), 852 guests, and 3 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
adviseLong Bug #464186
01/27/17 13:20
01/27/17 13:20
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
The following script can reproduce a potential bug. The script downloads asset history from Yahoo for the symbol "FRE.DE" and then tries to trade it.
The adviseLong functionality then tries to generate a function name with a . in it and therefore the script can not run in test mode.

Code:
// Gives a compiler error when trying to run the script after training
// The problem seems to be the . in the asset name downloaded from Yahoo.
// Zorro tries to generate a C function with a . in it.
// The asset name "FRE.DE" is a valid Yahoo finance asset name.
// https://finance.yahoo.com/quote/FRE.DE?p=FRE.DE

// Warning 034: No asset data for FRE.DE
// Rules: Test7  2000..2016 (5 cores)
// Train FRE.DE_L -Mar 2010- 53.0%
// Rules stored in Test7_1.c

// Run Test7..
// Walk-Forward Test: Test7 FRE.DE 2000..2016
// Error in 'line 3: 
// syntax error
// < int FRE.DE_L(float* sig) >
// Read Test7_1.c

int run()
{
	set(RULES | TESTNOW);

	BarPeriod = 1440;
	StartDate = 2000;
	TradesPerBar = 2;
	Hedge = 5;
	
	NumWFOCycles = 5;
	NumCores = -1;
	
	assetHistory("FRE.DE", FROM_YAHOO);
	
	while (asset(loop("FRE.DE")))
	{
		vars price = series(priceClose());
		var rsi2 = RSI(price, 2);
		var ma = SMA(price, 50);
		var ratio = price[0] / ma;
		
		LifeTime = 1;
		if (adviseLong(PERCEPTRON, 0, rsi2, ratio) > 55)
			enterLong();
	}
}


Re: adviseLong Bug [Re: trenki2] #464190
01/27/17 14:04
01/27/17 14:04
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Asset names are used for file names and also for variables in the rules, so they must not contain special characters. Rename "FRE.DE" to "FRE" after downloading it from Yahoo.

Re: adviseLong Bug [Re: jcl] #464196
01/27/17 14:57
01/27/17 14:57
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
Yes that will work but requires manual effort. Then I need to use two different asset names. One for downloading the history from Yahoo, this must be "FRE.DE" (or any other non US stock history) and then I need a second asset name "FRE" without the . in the asset loop.

Things would be 10x simpler and would not require any special code to go around that issue if Zorro would simply allow a . in the asset name and make a valid variable/function name out of it for instance by using

Code:
int FRE_DE_L(float* sig)



instead of the not working:
Code:
int FRE.DE_L(float* sig)



All that would be required is a string replace of special characters to _ in the Zorro code that produces the variable name.

This could be an enhancement for future Zorro versions, so using non US stock history symbols from Yahoo just works without special treatment.

Re: adviseLong Bug [Re: trenki2] #464205
01/27/17 16:56
01/27/17 16:56
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Yes, that makes sense. I'll put it on the to do list.

However, brokers and Yahoo have often different asset names, so in many cases you must rename them anyway.

Re: adviseLong Bug [Re: jcl] #464208
01/27/17 17:05
01/27/17 17:05
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
Yes for that I used the BrokerSymbol column in the Assets.csv file. That works well.


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