Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
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 (MadJack, AndrewAMD, Quad), 540 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
adviseLong returns 0 with custom Objective #470383
01/11/18 09:07
01/11/18 09:07
Joined: Feb 2017
Posts: 369
D
Dalla Offline OP
Senior Member
Dalla  Offline OP
Senior Member
D

Joined: Feb 2017
Posts: 369
Hi,

I'm trying to use a custom Objective for my advise functions, but right now my adviseLong always returns zero.

My Zorro code looks like this
Code:
var params[10];
params[0] = cubicDev10N[0];
params[1] = deltaPVR5N[0]; 
params[2] = deltabWidth3N[0]; 
params[3] = MMIFasterN[0]; 
params[4] = deltaMMIFastest10N[0]; 
params[5] = HurstFast[0]; 
params[6] = HurstFaster[0];
params[7] = ibsOneN[0];
params[8] = ATRSlowN[0];
params[9] = marketVolNorm[0];


	set(RULES);
	var myObje = ifelse(priceClose(-1) - priceClose(0) > 20,1,-1);
	LifeTime = 1;
	MaxLong = 1;


	if(Train) 
	{
		Hedge = 2;
		set(PEEK);
		adviseLong(NEURAL+BALANCED, myObje, params,10);
	}
	
	if(!Train)
	{
		var LongPrediction = adviseLong(NEURAL, myObje, params,10);
		printf("nPred for long is %f", LongPrediction);
		if(LongPrediction > 0.5)
		{				
			enterLong();
		}
	}



If I change my code to use SIGNALS during training, and give the resulting input to my neural.predict function straight from R, the predictions are returned as expected. So I must be doing something wrong on the Zorro side.

I've trying putting enterLong() in the if(Train) block as well, but that doesn't make any difference, and I don’t think it's needed when not using trade results as the target?

Anything obviously wrong with Zorro my code?

Last edited by Dalla; 01/11/18 09:07.
Re: adviseLong returns 0 with custom Objective [Re: Dalla] #470386
01/11/18 11:34
01/11/18 11:34
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Yes, trades are not needed when Objective != 0. At first glance I see nothing wrong with the Zorro code.

The #1 potential bug in machine learning R code is a neural.predict function that works with matrices, but not with vectors.

Re: adviseLong returns 0 with custom Objective [Re: jcl] #476939
04/25/19 21:35
04/25/19 21:35
Joined: Feb 2018
Posts: 68
T
tomaslolo Offline
Junior Member
tomaslolo  Offline
Junior Member
T

Joined: Feb 2018
Posts: 68
Hi all, I´ve been playing around sometime with advise function. I never get a different value different to zero when customizing my Objective.

As stated in the manual: https://zorro-project.com/manual/en/advisor.htm
"Returns:
In [Train] mode: 0 when Objective != 0, otherwise 100 (so that dependent trades are always executed for training)."

I don´t understand what is meant when saying "Returns". If Objective=0 next trade result is the target and should be the last column of the signals.csv, but if you use "var myObje = ifelse(priceClose(-1) - priceClose(0) > 20,1,-1);" as Dalla exposed or any other the last column of the signals.csv files is always 0.00000 or -0.00000.

Is this the expected behaviour? if so How can we customize the Objective value for predict other than next trade result?

Thank you

Re: adviseLong returns 0 with custom Objective [Re: tomaslolo] #476940
04/26/19 06:27
04/26/19 06:27
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
It returns 0 in training because otherwise it would enter a trade depending on your code. I can't tell why your csv contains wrong values, so check your script.

There are lots of examples of the advise function, with or without custom objective.The current beta version has also two more advise scripts. It should be no problem to modify one of the examples for your needs.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1