Gamestudio Links
Zorro Links
Newest Posts
freewhyblogelsewhere
by 9489cpjf. 06/03/24 06:06
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,323 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19056 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
RINA 3D optimization charts #435429
01/08/14 07:14
01/08/14 07:14

L
liftoff
Unregistered
liftoff
Unregistered
L



Is it possible to run an optimization on two parameters in a system like a slow moving MA and a fast moving MA and produce a 3D chart similar to the one produced by RINA in tradestation in Zorro?
If we can get Zorro to run optimization across all the selected parameter values and dump the numbers to a .txt file we can simply open it up in excel and analysis it in 3D mode or however best we see fit.
As far as I know current optimization in Zorro, takes the default value you selected for B when optimizing A and after that produce a 2D chart of Profit factor based on the steps from min to max of A giving the default value of B.
But it would also be nice if we can get 3 values in a sense. Starting with the min of B, Zorro does the current form of optimization for A, then steps up one, runs the same optimization for A giving the new value of B, steps up B one more runs the current form of optimization for A. So in the end we get 3 values, 1 for A, one for B and the profit factor and this gets written to a .txt file, we can import it into excel and do plateau analysis and similar stuff.

Re: RINA 3D optimization charts [Re: ] #435442
01/08/14 09:24
01/08/14 09:24
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Not with the current optimization method, which is not really an optimization but more a parameter adjustment for maximum robustness.

For a 3D chart you will need a brute force optimization by running 2 parameters through all combinations. You can do that with a script. Use the NumTotalCycles variable for that, and store the result of every cycle.

Re: RINA 3D optimization charts [Re: jcl] #435446
01/08/14 09:35
01/08/14 09:35

L
liftoff
Unregistered
liftoff
Unregistered
L



Thanks @jcl , funny enough I understand exactly what you said, but getting Zorro to it will be headache, low programming skills on my part. I am guessing it will follow a structure similar to tutorial 8? Can I get a sample code based on two simple moving averages, so I can build on from there? grin

Re: RINA 3D optimization charts [Re: ] #435450
01/08/14 09:48
01/08/14 09:48

A
acidburn
Unregistered
acidburn
Unregistered
A



I think your programming skills are more than adequate for this task, liftoff. But visualization will be a bitch. I'm not even sure API currently would allow for a custom 2D visualization (for example a scatter plot with both axis user defined), let alone some nice 3D surface plots. tongue

This is not to say that advsofteng's library that Zorro uses is not up to the task, it's actually very powerful. But probably some of it's API is not currently exposed to scripts.

I agree that exhaustive parameter search with simple 2D/3D visualization would be very helpful in the strategy research stage.

Re: RINA 3D optimization charts [Re: ] #435453
01/08/14 09:53
01/08/14 09:53
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You could export it to a .csv file and visualize it in Excel.

Re: RINA 3D optimization charts [Re: jcl] #435455
01/08/14 10:00
01/08/14 10:00

A
acidburn
Unregistered
acidburn
Unregistered
A



Yes, external visualization is probably the best way, atm.

Although I would prefer that Zorro in the future can be used even for such tasks. The library it is linked with already supports all kinds of funky charts http://www.advsofteng.com/gallery.html

Re: RINA 3D optimization charts [Re: ] #435458
01/08/14 10:03
01/08/14 10:03

L
liftoff
Unregistered
liftoff
Unregistered
L



LoL ... I feel so overwhelmed right now... But I am sure I will get there in a couple of months. I should be done with Jaekle and Tomasini's book by tomorrow so I will have some spare time to see if I can get zorro to spit out the needed figures in a csv file so I can do all the hunky punky stuff on excel.
Thanks a lot for the input guys@jcl & @acidburn, your efforts are well recognized.

Last edited by liftoff; 01/08/14 10:04.
Re: RINA 3D optimization charts [Re: ] #435464
01/08/14 10:22
01/08/14 10:22

L
liftoff
Unregistered
liftoff
Unregistered
L



I should be reading the manual a lot more. I think I just found some sample codes in there about how to write test results to csv files. I think a little tinkering around should lead me down the right path. I will post my sample code here when I manage to put together one, soon.

Re: RINA 3D optimization charts [Re: ] #435466
01/08/14 10:26
01/08/14 10:26

A
acidburn
Unregistered
acidburn
Unregistered
A



See, already "will get there in a couple of months" shrunk to "soon". If we don't get it by the end of the day... grin

Re: RINA 3D optimization charts [Re: ] #435481
01/08/14 12:52
01/08/14 12:52

L
liftoff
Unregistered
liftoff
Unregistered
L



I tried using the Luxor script to generate the csv file with the value of the slow moving MA, fast moving MA, Gross Profit and Gross Loss.
I failed miserably it seems.
Can anyone help point me where I am making mistakes?
Code:
function run()
{
	StartDate = 2003;
	EndDate = 2008;
	BarPeriod = 30;
	LookBack = 30;
	asset("GBP/USD");
	
	int Slow = 20;
	int Fast = 1;
	int MaxSlow = 60;
	int MaxFast = 10;
	
// no trade costs...	
	Spread = 0;
	Slippage = 0;
	RollLong = RollShort = 0;
	 
	for(Slow; Slow<=MaxSlow;++Slow){
		for(Fast; Fast<=MaxFast;++Fast){
				vars Price = series(priceClose()),
				Fast = series(SMA(Price,Fast)),
				Slow = series(SMA(Price,Slow));
				
				static var BuyLimit,SellLimit,BuyStop,SellStop;
				
				if(crossOver(Fast,Slow)) {
					BuyStop = priceHigh() + 1*PIP;
					BuyLimit = priceHigh() + 5*PIP;
				}
				if(crossUnder(Fast,Slow)) {
					SellStop = priceLow() - 1*PIP;
					SellLimit = priceLow() - 5*PIP;
				}
					
				if(!NumOpenLong && Fast[0] > Slow[0] && Price[0] < BuyLimit)
					enterLong(1,BuyStop);
				if(!NumOpenShort && Fast[0] < Slow[0] && Price[0] > SellLimit)
					enterShort(1,SellStop);
			
			if(is(EXITRUN)){
					char line[100];
	  				sprintf(line,
	    						"%i,%i,%i,%i\n",
	    						Slow,Fast,WinTotal,LossTotal);	  
	     			file_append("Data\\NetProfit.csv",line);
			}	
		}
	}
	
}


Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1