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

[amibroker] The Inspection Points and the Hi-pass Filter



PureBytes Links

Trading Reference Links




The
 
Counter=0; 
for(K=30;K<100;K=K+20){E1=MA(C,k);CountER=CountER+1;Plot(E1,"\nE1["+WriteVal(K,1.0)+"]",1+Counter,1);}
 
will plot in IB the group of simple moving averages MA(C,30), 
MA(C,50),MA(C,70) and MA(C,90).My data begins on Jan3, 2000.After some 
reasonable period the usual indicators are defined and may be compared.Let 
us select as a starting date the end of May2000.START=DateNum()==1000530 
;In T/A studies we use various parameters, not always the same. An MA(C,k) 
may give good results for k=30, but, as the market character changes, k=50 
may be more expressive, one year later. For this reason we 
re-optimizeparameters from time to time, hoping to see better performance in 
the [unknown] next days/weeks/months/yearsaccording to the used 
timeframe.How about doing this job automatically ?One method is to 
establish the Inspection Points.For example, the
 
x=101;START=DateNum()==1000530 
;EVENT=BarsSince(START)%x==0;PlotShapes(shapeCircle*EVENT,colorRed);
 
will establish an  Inspection [RED] Point every 101 bars 
after the START of May30, 2000.The AFL inspector will check the parameters 
under his criteria at the inspection points, will take a decision and will ask 
to apply this decision until the next inspection.Suppose the criterion is to 
ride on the highest MA and use this MA for the next 101 bars.The procedure 
should be repeated at all Inspection Points.The reslut will be a variable 
parameter k with a market feedback every 101 bars.The Hi-pass filter gives a 
solution to this request.
 
// A Hi-pass filter at the Inspection Pointsx=101;// the 
inspection frequencySTART=DateNum()==1000530 
;EVENT=BarsSince(START)%x==0;// the inspection 
eventPlotShapes(shapeCircle*EVENT,colorRed);// puts a red dot at the 
inspection 
pointsG=0;CountER=0; for(K=30;K<100;K=K+20){E1=MA(C,k);// 
the moving average value for the various kE11=ValueWhen(EVENT,E1);// the MA 
value at the inspection pointT11=ValueWhen(EVENT,Cum(1));// the inspection 
timeG=IIf(G>E11,G,E11);CountER=CountER+1;Plot(E1,"\nE1["+WriteVal(K,1.0)+"]",1+Counter,1);}Plot(G,"\nG",colorBlue,8);// 
this line remembers the highest MA until the next 
inspectionCountER=0;Kpass=0;HIPASS=0;for(K=30;K<100;K=K+20){E1=MA(C,k);E11=ValueWhen(EVENT,E1);CountER=CountER+1;PASS=IIf(E11==G,E1,0);HIPASS=HIPASS+PASS;K1=IIf(E11==G,K,0);Kpass=Kpass+K1;}Plot(HIPASS,"\nHI-PASS 
[k="+WriteVal(kpass,1.0)+"]",colorBlack,8);// the final Hi-pass line// 
Plot(Kpass,"Kpass",colorYellow,styleOwnScale);GraphZOrder=0;
 
The code lets the highest MA [at the inspection point] to pass 
the inspection and be in use until the next red dot.In the att. gif, at 
point P1 the green [90-bar] MA  was the highest. The Hi-pass [dotted black] 
line keeps this MA until pointP2, no matter if the green line was lower a 
few days after the inspection P1. At P2 the market character has changed to 
bullish.The 30-bar [white] MA is now the highest and the the new Hi-pass 
line will follow it for the next 101 bars.The blue G line gives the ground 
level, ie the value of the last inspection.You may see easier the final 
Hi-pass line by changing  GraphZOrder=0; to GraphZOrder=1;Uncomment the 
// Plot(Kpass,"Kpass",colorYellow,styleOwnScale); line to see the K values in 
the past history of the stock.The inspection method is objective, free from 
psychological constraints and helps to hold a decision for the next x 
trading days.
[this is more difficult than the code itself !!]
The inspection frequency may be fixed or variable 
.
[Since we usually Buy at +1 Open, we may re-inspect before 
every "Buy"...]
One interesting application is the parametric Equity 
.
If we ride on the highest equity line and we have the 
inspection feedback, we may avoid  the known dangers of 
overptimization
and make some more low-risk money.
Dimitris Tsokakis
 
 






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment:
InspPoints.gif

Attachment: Description: "Description: GIF image"