Ik heb een poging gedaan het onderstaande artikel om te zetten in Vesticode.
http://www.tradingpulse.com/downloads/evaluat.pdf.
Ik sta open voor verbeteringen en/of aanvullingen.
Invoegen onder report
value function zEfficiencyReport () begin
? ?{--- variables ---}
value xEntryEfL=0,xExitEfL=0,xTotalEfL=0,xEntryEfS=0,xExitEfS=0,xTotalEfS=0,
? ? ?xExitdate,xProfit[],xM,xExit,xEntry,xMP;
?{--- initialise ---}
?
value ?xCurrentBar,xBars,xdate,xContracts;
?xdate=date;
?xCurrentBar := CurrentBar;
?xBars := BarsSinceEntry(1)-BarsSinceExit(1);
?xExitdate:=ExitDate(1)-19000000 ;
?xProfit := PositionProfit(1);
?xEntry:=Entryprice(1);
?xM=totaltrades;
?xMP:=marketposition(1);
?xContracts:=Currentcontracts[1];
?{---Get Highest and Lowest close---}
value xLowestMinClose[],xHighestMaxClose[],xMinPrice,xMinCl=close,xMaxCl=close,xStartbar;
xStartbar:=BarsSinceEntry(0); ?
{---Highest Close Lowest Close---}
if xDate>xDate[1] then begin ?
? if close<xMinCl[1] then xMinCl=close
? ?else xMinCl=xMinCl[1];
? if close>xMaxCl[1] then xMaxCl=close
? ?else xMaxCl=xMaxCl[1];
end;
{---Highest Close Lowest Close xBars---}
?if xDate=xExitdate then begin
?xExit=close;
?xHighestMaxClose=Highest(xMaxCl,xBars);
?if xExit>xHighestMaxClose then xHighestMaxClose=xExit else xHighestMaxClose = xHighestMaxClose;
?xLowestMinClose=Lowest(xMinCl,xBars);
?if xExit<xLowestMinClose then xLowestMinClose=xExit else xLowestMinClose = xLowestMinClose;
?xMinPrice=xHighestMaxClose-xLowestMinClose;
?
end;
{---Effiency Long---}
if xMP=1 then begin
xEntryEfS=0;
xExitEfS=0;
xTotalEfS=0;
?xEntryEfL:=((xHighestMaxClose-xEntry)/(xMinPrice)*100;
?xExitEfL:=((xExit-xLowestMinClose)/(xMinPrice)*100;
?xTotalEfL:=((xProfit/xContracts)/xMinPrice)*100;
?
end;
{---Effiency Short---}
if xMP=-1 then begin
xEntryEfL=0;
xExitEfL=0;
xTotalEfL=0;
?
?xEntryEfS:=((xEntry-xLowestMinClose)/(xMinPrice)*100;
?xExitEfS:=((xHighestMaxClose-xExit)/(xMinPrice)*100;
?xTotalEfS:=((xProfit/xContracts)/xMinPrice)*100;
end;
{---Optellen en Average berekenen---}
value xSumEntryL=0,xSumEntryS=0,xSumExitL=0,xSumExitS=0,xSumTotL=0,xSumTotS=0,xSumEntry=0,xSumExit=0,xSumTot=0,
xAvgEntry=0,xAvgExit=0,xAvgTot=0;
if xMP=1 then begin
xSumEntryS:=0;
xSumExitS:=0;
xSumTotS:=0;
xSumEntryL:=xSumEntryL+xEntryEfL;
xSumExitL:=xSumExitL+xExitEfL;
xSumTotL:=xSumTotL+xTotalEfL;
end;
if xMP=-1 then begin
xSumEntryL:=0;
xSumExitL:=0;
xSumTotL:=0;
xSumEntryS:=xSumEntryS+xEntryEfS;
xSumExitS:=xSumExitS+xExitEfS;
xSumTotS:=xSumTotS+xTotalEfS;
end;
if xM>xM[1] then begin
xSumEntry:=xSumEntry+(xSumEntryL+xSumEntryS);
xSumExit:=xSumExit+(xSumExitL+xSumExitS);
xSumTot:=xSumTot+(xSumTotL+xSumTotS);
xAvgExit:=xSumExit/xM;
xAvgEntry:=xSumEntry/xM;
xAvgTot:=xSumTot/xM;
end;
{---Reset xMinCl and xMaxClose---}
if xStartbar=0 then begin
?xMinCl=close;
?XMaxCl=close;
end;
end;
if xM<>xM[1] then begin
{---- print the performance summary ----}
? ?if xMP=1 then begin
? ?print("LongTrades",xM:5:0);
? ?print("Entry Efficiency ?",xEntryEfL:5:1, ?"% | Total Efficiency ?",xTotalEfL:5:1,"%");
? ?print("Exit Efficiency ? ",xExitEfL:5:1,"%");
? ?end;
? ?if xMP=-1 then begin
? ?print("ShortTrades",xM:5:0);
? ?print("Entry Efficiency ?",xEntryEfS:5:1, ?"% | Total Efficiency ?",xTotalEfS:5:1,"%");
? ?print("Exit Efficiency ? ",xExitEfS:5:1,"%");
end;
end;
if xCurrentbar=vlastbar then begin
? ?print("TotalTrades",xM:5:0);
? ?print("Average Entry Efficiency ?",xAvgEntry:5:1, ?"% | Average Total Efficiency ?",xAvgTot:5:1,"%");
? ?print("Average Exit Efficiency ? ",xAvgExit:5:1,"%"); ? ?
end;
Groetjes Paul
(Edited by Paul M at 3:17 pm op 21,juni 2003)