door FM » do 06 maart 2003, 16:01
Beste Paul,
Is dit wat je zoekt?
System: zPaul
Value function zPaul (value xSeries[]=close, value XnumberOfBars1=6, value XnumberOfBars2=12,
value XnumberOfBars3=18,value xFactor=.7) begin
value xAvg1[],xAvg2[],xAvg3[];
{***** Calculaties EMA's *****}
xAvg1 :=vGD(vGD(vGD(xSeries,xNumberOfBars1,xFactor),xNumberOfBars1,xFactor),xNumberOfBars1,xFactor);
xAvg2 :=vGD(vGD(vGD(xSeries,xNumberOfBars2,xFactor),xNumberOfBars2,xFactor),xNumberOfBars2,xFactor);
xAvg3 :=vGD(vGD(vGD(xSeries,xNumberOfBars3,xFactor),xNumberOfBars3,xFactor),xNumberOfBars3,xFactor);
{***** Long Positie Handling *****}
if xAvg1 > xAvg2 and xAvg2 > xAvg3 AND (xAvg3 > xAvg3[1] AND xAvg3[1] > xAvg3[2]) {trend validatie} then Buy; ?
if xAvg1 <xAvg2 OR (xAvg3 < xAvg3[1] AND xAvg3[1] < xAvg3[2]) then vExitLong; {Van de OR statements kan er ook een enkele geselecteerd worden}
if xAvg1 < xAvg2 and xAvg2 < xAvg3 AND (xAvg3 < xAvg3[1] AND xAvg3[1] < xAvg3[2]) {trend validatie} then Sell; ?
if xAvg1 > xAvg2 OR (xAvg3 > xAvg3[1] AND xAvg3[1] > xAvg3[2]) then vExitShort; {Van de OR statements kan er ook een enkele geselecteerd worden}
{***** Plot Statements *****}
plot1 (xAvg1,'xAvg1'+NumToStr(xNumberOfBars1));
plot2 (xAvg2,'xAvg2'+NumToStr(xNumberOfBars1));
plot3 (xAvg3,'xAvg3'+NumToStr(xNumberOfBars1));
end;
Function: vGD
Value function vGD (value xSeries[],value xNumberOfBars,value xFactor) begin
Value xX1[],xX2[];
xX1 :=xAverage(xSeries,xNumberOfBars)*(1+xFactor);
xX2 :=xAverage(xAverage(xSeries,xNumberOfBars),xNumberOfBars)*xFactor;
vGD :=xX1-xX2;
end;
Testresultaten op kwartierkoersen 2002
Total net profit ? ? ?41095.99 ?
Gross profit ? ? ? ? 177576.01 ?
Total # of trades ? ? ? ? 261 ?
Percentage profitable ? ? 42%
Number winning trades ? ? 109 ?
Number losing trades ? ? ?152
Largest winning trade ?7408.00 ?
Largest losing trade ?-4256.00
Average winning trade ?1629.14 ?
Average losing trade ? -897.89
Ration avg win/loss ? ? ? 1.81 ?
Max intraday drawdown ? ? 2.01
Profit factor ? ? ? ? ? ? 1.30 ?
De performance is nog niet echt fantastisch maar voor een trendvolgend systeem is het niet al te slecht. Je kunt nog naar de volgende mogelijkheden kijken.
Combinatie TEMA en EMA's, StopLoss en TrailingStop inbouwen, trend valideren met een andere indicator eventueel aparte waarden voor Long en Short posities
succes,
Frans.