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

RE: [amibroker] Re: Logic for MaxDD while in a Buy Period



PureBytes Links

Trading Reference Links

For every Buy period, the equity curve will have a drawdown (unless it is
straight up).  I want the LARGEST (or Max) of these when the signal is on a
Buy.   What I meant by "special case" is that the code performs correctly in
most cases, except in a couple of situations where the price continues down
after a brief sell period.  Then, the highest value is from the former Buy
period, but the calculation uses the lower value of CurEq2 in the new
period.  Said still another way, the CurDD2 calculation should be performed
only WITHIN each Buy period, not across Buy periods.

Regarding your comment, if what I should have said is that I want CurDD,
then I want the Maximum of all CurDD for each Buy Period.

What should I be using?

Thanks. 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Fred
Sent: Saturday, January 20, 2007 11:02 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Logic for MaxDD while in a Buy Period

Special case ?

What you are describing is NOT MaxDD ... If I am reading your description (
with errors ) correctly, what you are after is the equivalent of CurDD ...

Yes ?

--- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <ken45140@xxx> wrote:
>
> I can not get the logic written to take care of a special case.
>  
> My objective is to determine the MaxDD in an equity curve (or the
Close
> Price line) while a signal is on a Buy.
>  
> I have used the following code snippit:
>  
> CurEq2   =  Gain2chrt;
> 
> MaxEq2   =  Highest(CurEq2);
> 
> CurDD2   =  IIf(BIR, 100 * (MaxEq2 - CurEq2) / MaxEq2, 0);
> 
> MaxDD2   =  Highest(CurDD2);
> 
>  
>  
> In most cases this is producing the correct answer, but I have
discovered
> certain cases where it delivers the wrong answer.
>  
> If the price (or Equity curve) has a down period in the NEXT buy
period, the
> code will still have as the HIGHEST value, the value from the
PREVIOUS buy
> period. This produces an incorrect value.   The Highest function is 
looking
> for the highest value in the array MaxEq2 no matter when it
occurred.   I
> have not been able to figure out how to use the HHV function as the
length
> of the buy periods varies. 
>  
> How can I write this logic so that the MaxEq2 variable will "reset" 
after
> each Buy period expires, and be ready to determine the largest
value in each
> new Buy Period?
>  
> Thanks for any help.
>  
> Ken
>




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





Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.2/641 - Release Date: 1/20/2007 10:24 AM