Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (dBc), 18,007 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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: 28,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
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: 28,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
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