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

Lars Kestner K Ratio



PureBytes Links

Trading Reference Links

Zookeeper asked:

Anybody have the ELA codes for Lars Kestner's KRatio? I heard on the
grapevines that it's a better measurement of risk than the Sharpe Ratio. Any
comments? Any codes?

Back in May Andy [adle@xxxxxxxxxx] posted the following message:

Going through previous issues of TASC, I found a useful tool developed by
Lars Kestner called the "K_Ratio" (pg. 46 of the 1996 March issue of
Technical Analysis of Stocks and Commodities). It is actually designed as a
system to be include in your system(s). What it does is measure your
system's profitablity over time by doing a statistical analysis of your
equity curve.
The ratio usually range between +5 and -5. An extreme positive value means
that your system is profitable and stable (stability means that your profits
are consistent in dollar amounts). A value near 0, on the positive side (+1
or so), means that the system is marginally profitable and that the profit
stream is highly inconsistent. Any negative values means that it is a losing
system over time. And any extreme negative values means that your systems
vendor just ripped you off and that you're fucked, up shit creek without a
paddle in a sinking boat. ;-)
I want to thank Lars Kestner for this very useful tool (at least for
systematic traders).
Anyway, here's the code (you can use the copy and paste command to put this
in the power editior as a system) :
{system: K_Ratio}
Var: Obs(0),Count(0),SumXY(0),SumX(0),SumY(0),SumXSqr(0),Beta0(0),Beta1(0);
Var: SumResidSqr(0),SigmaRegress(0),StdErrB(0), YProj(0),KRatio(0);
Array: Equity[5000](0);
Obs=Obs+1;
Equity[obs]=NetProfit+OpenPositionProfit;
If Date=LastCalcDate then begin
For count=1 to Obs begin
SumXY=SumXY+(Count*Equity[Count]);
SumX=SumX+Count;
SumY=SumY+Equity[Count];
SumXSqr=SumXSqr+Count*Count;
end;
Beta1=(SUmXY-(SumX*SumY)/Obs)/(SumXSqr-(SumX*SumX)/Obs);
Beta0=(SumY/Obs)-Beta1*SumX/Obs;
For Count=1 to Obs begin
YProj3/4ta0+(Beta1*Count);
SumResidSqr=SumResidSqr+Square(Equity[Count]-YProj); end;
SigmaRegress=SquareRoot(SumResidSqr/(Obs-2));
StdErrB=SigmaRegress/SquareRoot(SumXSqr);
Kratio3/4ta1/(StdErrB*SquareRoot(Obs));
Print("Kratio",Kratio:4:2); end;


I haven't used this, just remembered saving it to play with later.

Paul