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

[amibroker] Another Code Puzzle


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: [amibroker] Another Code Puzzle
  • From: "Ken Close" <ken45140@xxxxxxxxx>
  • Date: Wed, 13 Aug 2008 13:56:36 -0400
  • Authentication-results: gwout2 smtp.user=ksclose; auth=pass (LOGIN)

PureBytes Links

Trading Reference Links

Once again, I stumble across seemingly simple things that are hard (for me) to do.
 
Task: Find the Date of the MaxDD which occurs in a price series (Equity or price).
More complex task: Find the Date when the current MaxDD started, ie, the highest price associated with the MaxDD.
 
FredT has had code for finding the MaxDD since almost from when AB started.  We all have used it countless times.
Yet I can not adapt or adopt it to finding the date when the MaxDD occurs much less find the Date of the highest price associated with the Maxdd.
 
Can anyone suggest an approach?
 
Ken
 
Code snippits:
 
 
 
 
BIR = IIf(Status("BarInRange") > 0, 1, 0);
Price = C;
MaxPrice = Highest(Price);
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);
 
This last line, my attempt, is not correct; it works some of the time but not with all cases.
 
 
 
__._,_.___

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

__,_._,___