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

RE: RE: [amibroker] Another Code Puzzle



PureBytes Links

Trading Reference Links

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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of tipequity
Sent: Friday, August 15, 2008 1:15 AM
To: amibroker@xxxxxxxxxxxxxxx
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___