Happy Dairy - Part 2

#11
Parameters optimisation has a danger that it looks great on the sample data ( because of optimisation ) and it may do poorly when out of sample tests done. So it is better to select parameters which give satisfactory results over many different data samples. That makes the system more robust.

My 2 cents from my experience of optimisation from my early years.

Smart_trade
Exactly why it is called Fools' Gold :lol:



Fools Gold - Iron Pyrite

Cheers

:) Happy
 
#12
Parameters optimisation has a danger that it looks great on the sample data ( because of optimisation ) and it may do poorly when out of sample tests done. So it is better to select parameters which give satisfactory results over many different data samples. That makes the system more robust.

My 2 cents from my experience of optimisation from my early years.

Smart_trade
Hello ST

Thanks for commenting on this thread :)



Now the thing is that even if we do not change anything and use standard values we end up with an effect of optimized parameters,
the default values also have the same effect.

As ST has said above instead of looking at peak performers we should look at robust performers . . .

One way is take many different samples and test them independently,
in addition to that first look at the cluster of parameters in a similar band of performance and then eliminate all the outlines . . .

For e.g. MA 63 is giving best performance . . . double than say all of the MAs in range 20 to 45, but MA 60,61,62 and 64,65, 66 are total disaster then this cluster from 60 to 66 needs to be totally discarded and we have a re-look at 20 to 45 for more robustness . . . we just sacrifice the double performance giving number 63 because it is surrounded by bad ones ;)

Effectively we should finalize only those parameters such that a small change (10-20%) in them on either side does not effect the outcome very much.

This brings us to another question . . . how do we evaluate the performance . . of a trading system.


Many won't believe me when i say I don't even look at points gained or gains made in rupees terms . . .

Amibroker gives us many such factors and ratios to evaluate system performance, one can go through the help files to understand more about them.

Things like max draw down, RAR/MDD, CAR/MDD, etc are important but to my mind the most important factor is
payoff ratio . . . anything below 2 and the system is untradable . . .
I will happily accept a system that has higher payoff ratio and profit factor but far lesser overall profit . . .


Cheers


:) Happy
 
#13
Hello

Meanwhile I have got an AFL in mail . . . modified/enhanced version of my previous back test AFL . . .

Warning: It runs 24000 iterations that's a crazzy big number . . .
anyway I will just go ahead and post it,
don't run it on bigger data sets and
don't run it if you have old systems :D

Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("LODU BACK TEST");

w = Optimize("PERIOD 1",Param("PERIOD 1",50,5,50,5),10,50,10);
x = Optimize("PERIOD 2",Param("PERIOD 2",40,5,50,5),10,50,10);
y = Optimize("MAType 1",Param("MAType 1",4,1,8,1),1,8,1);
z = Optimize("MAType 2",Param("MAType 2",3,1,8,1),1,8,1);

r = Optimize("Rule Type",Param("Rule Type",7,1,15,1),1,15,1);

m=0;	if (y==1) m	=	MA(C,w);	
else	if (y==2) m	=	EMA(C,w);	
else	if (y==3) m	=	DEMA(C,w);	
else	if (y==4) m	=	TEMA(C,w);	
else	if (y==5) m	=	WMA(C,w);	
else	if (y==6) m	=	HMA(C,w);	
else	if (y==7) m	=	Wilders(C,w);	
else	if (y==8) m	=	LinearReg(C,w);

e=0;	if (z==1) e	=	MA(m,x);	
else	if (z==2) e	=	EMA(m,x);	
else	if (z==3) e	=	DEMA(m,x);	
else	if (z==4) e	=	TEMA(m,x);	
else	if (z==5) e	=	WMA(m,x);	
else	if (z==6) e	=	HMA(m,x);	
else	if (z==7) e	=	Wilders(m,x);	
else	if (z==8) e	=	LinearReg(m,x);

Plot(m," MA 1",IIf(m > Ref(m,-1),colorBlue,colorRed),styleThick);
Plot(e," MA 2",IIf(e > Ref(e,-1),colorDarkGreen,colorYellow),styleThick);
// using only price & m
		if (r==1) {UP = C > m;						DN = C < m;}
else	if (r==2) {UP = m > Ref(m,-1);				DN = m < Ref(m,-1);}
else	if (r==3) {UP = C > m AND m > Ref(m,-1);	DN = C < m AND m < Ref(m,-1);}
else	if (r==4) {UP = H > m AND m > Ref(m,-1);	DN = L < m AND m < Ref(m,-1);}
else	if (r==5) {UP = L > m;						DN = H < m; }
else	if (r==6) {UP = L > m AND m > Ref(m,-1);	DN = H < m AND m < Ref(m,-1);}
// using only price & e
else	if (r==7)  {UP = C > e;						DN = C < e;}
else	if (r==8)  {UP = e > Ref(e,-1);			DN = e < Ref(e,-1);}
else	if (r==9)  {UP = C > e AND e > Ref(e,-1);	DN = C < e AND e < Ref(e,-1);}
else	if (r==10) {UP = H > e AND e > Ref(e,-1);	DN = L < e AND m < Ref(e,-1);}
else	if (r==11) {UP = L > e;						DN = H < e; }
else	if (r==12) {UP = L > e AND e > Ref(e,-1);	DN = H < e AND m < Ref(e,-1);}

// using all: price, m & e
else	if (r==13) {UP = C > m AND m > e;						DN = C < m AND m < e;}
else	if (r==14) {UP = m > Ref(m,-1) AND e > Ref(e,-1);	DN = m < Ref(m,-1) AND e < Ref(e,-1);}
else	if (r==15) {UP = C > m AND m > e AND m > Ref(m,-1) AND e > Ref(e,-1);
					 DN = C < m AND m < e AND m < Ref(m,-1) AND e < Ref(e,-1);}

Buy  = UP AND NOT (DN);
Sell = DN AND NOT (UP);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = Sell; Cover = Buy;
PlotShapes(Buy+2*Sell,colorWhite,0,IIf(Buy,L,H));
SetPositionSize(1,4);

_SECTION_END();
Cheers


:) Happy
 
Last edited:
#14
Follow up on the opportunity trade based on the small range expiry day . . .






We have used the expiry day range as resistance band, but now with gap down and bearish follow through
we can lower it to the gap or even lower to the S/R line marked on the chart and yesterdays opening high . . .

Cheers

:) Happy
 
#15
Hi

Just in to the third day ahd had to close the short trade :)




Was quite sure after yesterdays gap down, that we will reach below 9.5 k quite easily, but markets have their own mind . . .

For now Longs only for intraday, the range on expiry day is still relevant, if we had not touched/crossed the gap then
the gap would have been our new decision zone, but now we go back to the last expiry day range as point of control for this expiry.


Cheers


:) Happy
 
Thread starter Similar threads Forum Replies Date
S Welcome 3
MSN1979 Swing Trading 1
DayTrader007 General Chit Chat 5
tkamal General Chit Chat 2
Happy_Singh Trading Diary 236

Similar threads