[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Using Optimizer to test yearly/monthly results



PureBytes Links

Trading Reference Links

Here is some code I use to test using the optimizer to get a breakdown
on either a yearly or monthly basis. The Net % Profit is accurate
along with the MaxDD, while CAR and other values get reduced by the
year range value. 

Set    Buy =   ...... AND BuyIndex

You need to have Settings->Pad align data checked
for it to work.

Tom B




numyear = Year();

YR[0] = 2000;
YR[1] = 2001;
YR[2] = 2002;
YR[3] = 2003;
YR[4] = 2004;
YR[5] = 2005;
YR[6] = 2006;

YR[10] = 1990;
YR[11] = 1991;
YR[12] = 1992;
YR[13] = 1993;
YR[14] = 1994;
YR[15] = 1995;
YR[16] = 1996;
YR[17] = 1997;
YR[18] = 1998;
YR[19] = 1999;

mon =  Month();

systest = Param(  "SysTest 2=mo 3=yr 4=YR9",1,1,4);

if ( systest >= 2 )  //   Close all other optimazitions
{
	if ( systest == 2 )  // Monthly SET AA window for full year
	{		//  SysTest == 2
		MOindex = Optimize("MOindex",1,1,12,1);  // 
   		BuyIndex = IIf( Month() == MOindex,1,0);
	}
   if ( systest == 3 )  //  Yearly    
   {
	        //   YEARS   2000-2006
		YRindex = Optimize("YRindex",0,0,6,1);// set AA 
window from 2000 - 2006 for testing
		BuyIndex = IIf( numyear == YR[YRindex], 1,0);
   	}
	if ( systest == 4 )  //  Yearly     Close all other 
optimazitions
   	{		//  YEARS 1990-1999
		YRindex = Optimize("YRindex",10,10,19,1);// set AA 
window from 2000 - 2006 for testing
		BuyIndex = IIf( numyear == YR[YRindex], 1,0);
   	}
}
else

	BuyIndex = 1; 
 


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.2/613 - Release Date: 1/1/2007 2:50 PM