Here you go:

Ken

// DrawDownTitle.afl
Price = C;
MaxPrice = Highest(Price);
BIR = IIf(Status("BarInRange") > 0, 1, 0);
CurDD = IIf(BIR, 100 * (MaxPrice - Price) / MaxPrice, 0);
MaxPriceDate = IIf(BIR,ValueWhen(MaxPrice !=
Ref(MaxPrice,1),DateTime(),0),0);
MaxDD = Highest(CurDD);
RCurDD = round(CurDD * 100) / 100;
MaxDD = Highest(CurDD);
MaxDDDate = ValueWhen(MaxDD != Ref(MaxDD,-1),DateTime(),0);
RMaxDD = round(MaxDD * 100) / 100;
SqrDD = CurDD ^ 2;
CumDD = Cum(SqrDD);
MDD = MaxDD==LastValue(MaxDD) AND CurDD==MaxDD;
MDDBar = ValueWhen(MDD,BarIndex(),1);
CDDBar = Cum(0);
CDD0 = LastValue(Highest(IIf(MDD == 1, BarIndex() - BarsSince(CurDD == 0),
0)));
CDDBar[CDD0] = 1;
MaxDDDate = ValueWhen(MDD==1,DateTime(),1);
CDDDate = ValueWhen(CDDBar==1,DateTime(),1);
Plot(C,"",colorBlack,styleLine);
PlotShapes(CDDBar*shapeDownTriangle,colorRed);
PlotShapes(MDD*shapeUpArrow,colorGreen);
Title = Name() + " --- MaxDD = " + WriteVal(MaxDD,1.2) + 
"\n Start of MaxDD = " + WriteVal(CDDDate,formatDateTime) + 
" End of Mdd = " + WriteVal(MaxDDDate,formatDateTime);



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of tipequity
Sent: Friday, August 15, 2008 1:15 AM
To: [email protected]
Subject: Re: RE: [amibroker] Another Code Puzzle

Fred

Is there a way to include the starting and ending dates for max drawdown in
the title? TIA


------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links




Reply via email to