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
2 registered members (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
CCI Hook from extreme #409687
10/20/12 21:26
10/20/12 21:26
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Here is a fun little script that I put together. It trades the hook from an extreme reading on the cci so when the cci prints above the extreme level and then drops back below it or drops below the lower level and then trades above it you enter a trade with an atr stop and an adjustable atr profit multiple.

I have tried a few variations and 20, 100, 3 seems quite good. I am using this as a learning tool to learn how to use the optimisation features. I will try to include optimisation for one parameter to start with and then increase from there. If I get stuck I will ask for help!

I would be grateful for any help if you can see anything wrong with the script? I have set it to trade all possible instruments but of course they are not all profitable. With the losing instruments taken out it would probably be quite good.

Code:
function run() 
{
	while(asset(loop("AUD/USD","EUR/USD","GBP/USD","GER30","NAS100","SPX500","UK100","UKOil","US30","USD/CAD","USD/CHF","USD/JPY","USDOLLAR","USOil","XAG/USD","XAU/USD")))
	{
	var *ClosePrice = series(priceClose());
	var ccilength = slider(1,20,5,100,"Length",0);
	var cciextreme = slider(2,100,50,300,"Extreme",0);
	var cciextremen = (cciextreme*-1);
	var profatr = slider(3,2,1,5,"Profit ATR",0);
	var *cci = series(CCI(ccilength));
	Stop = ATR(20);
	Profit = profatr*ATR(20);
	
	if(cci[1] > cciextreme && cci[0] < cciextreme)
	    enterShort();
	if(cci[1] < cciextremen && cci[0] > cciextremen)   
	    enterLong();
   }
}


Re: CCI Hook from extreme [Re: hughbriss] #409689
10/20/12 21:33
10/20/12 21:33
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
All instruments included it is 81% 2454 pips/yr. With only the instruments that showed a profit factor of greater than 1.25 it is 86% 5581 pips/yr. Why it only makes a small difference to the % I don't know? With only instruments with a profit factor over 1.5 it is 159% 1681 pips/yr.

Re: CCI Hook from extreme [Re: hughbriss] #409692
10/20/12 22:08
10/20/12 22:08
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Ok, here is my first attempt at using optimisation. If I use the train button it does test the parameters and the test then comes out with a higher profit figure so I am guessing that it did something but I don't get a graph from the test function with the parameters on like you do in the tutorials. Am I doing something wrong? What should the LookBack period be set to?

Code:
function run() 
{
	set(PARAMETERS);
	BarPeriod = 1440;
	LookBack = 500;
	
	while(asset(loop("AUD/USD","EUR/USD","GBP/USD","GER30","NAS100","SPX500","UK100","UKOil","US30","USD/CAD","USD/CHF","USD/JPY","USDOLLAR","USOil","XAG/USD","XAU/USD")))
	
	{
	var *ClosePrice = series(priceClose());
	var ccilength = slider(1,20,5,100,"Length",0);
	var cciextreme = slider(2,100,50,300,"Extreme",0);
	var cciextremen = (cciextreme*-1);
	var profatr = optimize(3,1,5,0.5,0);
	var *cci = series(CCI(ccilength));
	Stop = ATR(20);
	Profit = profatr*ATR(20);
	
	if(cci[1] > cciextreme && cci[0] < cciextreme)
	    enterShort();
	if(cci[1] < cciextremen && cci[0] > cciextremen)   
	    enterLong();
   }
}


Re: CCI Hook from extreme [Re: hughbriss] #409694
10/20/12 22:19
10/20/12 22:19
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Ok, I've worked it out. You don't get the optimisation charts if you are training more than one instrument.

Here is the script with all parameters optimised. This is probably over optimised but it comes out with 162% 15757 pips/yr.

Code:
function run() 
{
	set(PARAMETERS);
	BarPeriod = 1440;
	LookBack = 500;
	
	while(asset(loop("AUD/USD","EUR/USD","GBP/USD","GER30","NAS100","SPX500","UK100","UKOil","US30","USD/CAD","USD/CHF","USD/JPY","USDOLLAR","USOil","XAG/USD","XAU/USD")))
	
	{
	var *ClosePrice = series(priceClose());
	var ccilength = optimize(20,5,200,5,0);
	var cciextreme = optimize(100,50,250,25,0);
	var cciextremen = (cciextreme*-1);
	var profatr = optimize(3,1,5,0.5,0);
	var *cci = series(CCI(ccilength));
	var stopatr = optimize(1,0.5,5,0.5,0);	
	
	Stop = stopatr*ATR(20);
	Profit = profatr*ATR(20);
	
	if(cci[1] > cciextreme && cci[0] < cciextreme)
	    enterShort();
	if(cci[1] < cciextremen && cci[0] > cciextremen)   
	    enterLong();
   }
}



Does this optimise all parameters for each instrument seperately? I think it would be best to run the optimisation on one pair and then use the optimal settings for all pairs. This would be more robust and less curve fitted.

Re: CCI Hook from extreme [Re: hughbriss] #409706
10/21/12 09:41
10/21/12 09:41
Joined: Oct 2012
Posts: 22
G
Guiom Offline
Newbie
Guiom  Offline
Newbie
G

Joined: Oct 2012
Posts: 22
Quote:
Does this optimise all parameters for each instrument seperately? I think it would be best to run the optimisation on one pair and then use the optimal settings for all pairs. This would be more robust and less curve fitted.


When you optimize there is a .par file in C:\Program Files\Zorro\Data which contains the optimized parameters.

I optimized the strategy with only EU and AU and the parameter file shows that each asset is optimized on its own:
AUD/USD: 24.6 99.0 4.03 +0.790=> 4.114
EUR/USD: 80.2 97.9 4.02 +0.760=> 2.318

So here for AUD/USD, ccilength=24.6, cciextreme=99.0, profatr=4.03 and stopatr=0.79.

Not sure how Zorro handles CCI(24.6) tho? Does is use CCI(24) or CCI(25)?

If I am wrong I would appreciate if jcl could correct me.

Thanks
Guiom

Re: CCI Hook from extreme [Re: Guiom] #409719
10/21/12 10:01
10/21/12 10:01
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Interesting. This is why we need to be careful not to over fit the parameters.

Re: CCI Hook from extreme [Re: hughbriss] #409720
10/21/12 10:11
10/21/12 10:11
Joined: Oct 2012
Posts: 22
G
Guiom Offline
Newbie
Guiom  Offline
Newbie
G

Joined: Oct 2012
Posts: 22
Yes it seems too easy to overfit the parameters and find profitable strategies!

Re: CCI Hook from extreme [Re: Guiom] #409721
10/21/12 10:24
10/21/12 10:24
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
I achieved my main aim though which was to get up to speed with the use of optimised parameters.

I've got an idea for a system improvement already...

Re: CCI Hook from extreme [Re: hughbriss] #409756
10/22/12 07:10
10/22/12 07:10
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Originally Posted By: hughbriss
I think it would be best to run the optimisation on one pair and then use the optimal settings for all pairs. This would be more robust and less curve fitted.

Using settings from one pair for a different pair is not recommended. It would not be any more robust, it would just be less profitable or probably not work at all.

For checking if the strategy is overfitted, test out of sample. Use either:

Code:
if(Train) set(PARAMETERS+SKIP3);
if(Test) set(PARAMETERS+SKIP1+SKIP2);



for horizontal splitting, or for the final test,

Code:
set(PARAMETERS);
DataSplit = ... // 75% to 90%
NumWFOCycles = ... // 6 to 12 cycles



for WFO. Look in the manual under "Training" for details.

Re: CCI Hook from extreme [Re: jcl] #409759
10/22/12 07:26
10/22/12 07:26
Joined: Sep 2012
Posts: 99
T
TankWolf Offline
Junior Member
TankWolf  Offline
Junior Member
T

Joined: Sep 2012
Posts: 99
Jcl this is one area that Im still having alot of trouble, I spent a good few hours going through the manual reading about the different ways of optimizing and testing the data & Im confused to say the least.

Some questions I have:

1. How do you decide whether its best to use horizontal, vertical or WF optimizations?
2. How do you decide how many WFO cycles to run?
3. How do you decide if you datasplit what ratio's you should test and train in?
4. In what situations to use datasloping?

I have more but this would be a helpful start. Im sorry if these are dumb questions but from reading the manual this seems like the most important part of the process and I really want to understand this side of things as best as possible.

Page 1 of 2 1 2

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