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

Max drawdown calculation



PureBytes Links

Trading Reference Links

I've always wondered exactly how TS4 calculates its "intraday 
drawdown" value.  The online help is vague, and implies that it uses 
only closed equity.  Today I finally experimented a bit until I 
figured it out.

It's not max peak-to-valley closed equity, nor is it max peak-to-
valley open equity.  It's a mix of the two:  it's the max closed 
equity minus the lowest open equity.

In case you want it, this code will compute it:

vars: OpEq(0), EqPeak(0), MaxDD(0);
OpEq = NetProfit+OpenPositionProfit;
EqPeak = MaxList(EqPeak,NetProfit);
MaxDD = MinList(MaxDD, NetProfit+MaxPositionLoss-EqPeak);

The code works only in a system.  The "position information" vars 
only work in systems.  If you want it in an indicator, something like 
this should work (but I haven't tested it):

vars: OpEq(0), EqPeak(0), MaxDD(0);
OpEq = I_OpenEquity;
EqPeak = MaxList(EqPeak,I_ClosedEquity);
MaxDD = MinList(MaxDD, I_ClosedEquity+I_MaxPosLoss-EqPeak);

Unfortunately there isn't any "I_MaxPosLoss" var.  You'd have to 
calculate that yourself.

Gary