Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
adviseLong/Short #410605
11/06/12 08:03
11/06/12 08:03
Joined: Sep 2012
Posts: 74
Niedersachsen, Germany
P
PriNova Offline OP
Junior Member
PriNova  Offline OP
Junior Member
P

Joined: Sep 2012
Posts: 74
Niedersachsen, Germany
Hi zorro's

i read the manual about the adviseLong/-short command, but there are no examples in it? are their any here?

this is my code i used how i understand this command:

Code:
function run()
{
	set(TICKS|RULES);
	StartDate = 20100101;
	
	
	var lv = 20;
	var hv = 80;
	int tradeL, tradeS;
	
	var *stochs = series(Stoch(5,3,MAType_SMA,5,MAType_SMA),20);
	tradeL = adviseLong(DTREE, 0, lv,hv, stochs[0],stochs[1]);
	tradeS = adviseShort(DTREE, 0, lv,hv, stochs[0],stochs[1]);
	Stop = 2*ATR(100);
	if( tradeL > 0)
	{
		exitShort();
		if(numLong() ==0) enterLong();
	} 
	if( tradeS > 0) 
	{
		exitLong();
		if(numShort() ==0) enterShort();
	}
}



and the prediction after training ist 0%

the .rul file looks like:

Code:
// Prediction rules generated by Zorro

int EURUSD_L(float* sig)
{ return -100; }

int EURUSD_S(float* sig)
{ return -100; }

// Prediction accuracy: 0%



did i something wrong here?

Re: adviseLong/Short [Re: PriNova] #410621
11/06/12 12:36
11/06/12 12:36
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Yes, you must set HEDGING here in Train mode. Otherwise your second trade immediately closes the first and the advise function can not get any useful result.

The prediction accuracy can also be 0 when the parameters are totally uncorrelated to the trade result.

This is a test script:

Code:
var signal(var val1,var val2)
{
	return (val2-val1)/PIP;
}

void run()
{
	BarPeriod = 1440;
	set(RULES|HEDGING);
	asset("SPX500");
	
	var *Close = series(priceClose()),
		*High = series(priceHigh()), 
		*Low = series(priceLow()); 
	
	var LPH = LowPass(High,100),
		LPL = LowPass(Low,100);

	Stop = 50*PIP; 
	TakeProfit = 50*PIP;

	var S1 = signal(*Close,LPH),
		S2 = signal(*Close,LPL),
		S3 = signal(*Close,*High),
		S4 = signal(*Close,*Low),
		S5 = signal(LPH,LPL);
			
	if(adviseLong(DTREE,0,S1,S2,S3,S4,S5) > 0)
		enterLong();
	if(adviseShort(DTREE,0,S1,S2,S3,S4,S5) > 0)
		enterShort();
}



Re: adviseLong/Short [Re: jcl] #410631
11/06/12 13:32
11/06/12 13:32
Joined: Sep 2012
Posts: 74
Niedersachsen, Germany
P
PriNova Offline OP
Junior Member
PriNova  Offline OP
Junior Member
P

Joined: Sep 2012
Posts: 74
Niedersachsen, Germany
Thank you. now it works even if the results are bad. hehe

But if i use your script with another asset like EUR/USD he says in the middle of training: too many trades.

is there a way to extend the number of trades?

Re: adviseLong/Short [Re: jcl] #410644
11/06/12 17:28
11/06/12 17:28
Joined: Oct 2012
Posts: 22
G
Guiom Offline
Newbie
Guiom  Offline
Newbie
G

Joined: Oct 2012
Posts: 22
Hi jcl,
Just being curious, do the Z1 and Z2 strategies use these functions?
Thanks
Guiom

Re: adviseLong/Short [Re: Guiom] #410661
11/06/12 20:08
11/06/12 20:08
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
PriNova: The reason is that this script places two trades on every bar. There's a memory limit for the number of trades, so better reduce the number of simultaneously open trades, as you did in your first script.

Guiom: No, Z1 and Z2 do not use yet artificial intelligence functions. In fact we have not yet found a strategy that would really improve by AI, but we have also not yet systematically looked for it.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1