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

RE: [amibroker] Calculation of Equity and Drawdowns - trying to understand what's going on..



PureBytes Links

Trading Reference Links










I would like to clarify the difference
between Maxdd and Max “Loss in Trade”

 

As an example, suppose I buy a stock at 90
and it rises to 100, then falls to 80, then rises to 85, and I sell it at 85.
(Or the system makes these events happen.)

 

I think the MaxDD is 20% (100-80/100) or
20/100, but the Max Loss in Trade is 5.55%  (90-85/90) or 5/90.  This
latter phrase assumes that the 5.55% is the maximum loss of all trades during
the backtest period.

 

Is this correct?

 

Ken

 

-----Original Message-----
From: Tomasz Janeczko
[mailto:amibroker@xxxxxx] 
Sent: Friday, May 16, 2003 5:33 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker]
Calculation of Equity and Drawdowns - trying to understand what's going on..

 





Hello,





 





The rule with no commission, no interest:





 





Profit = ( SellPrice - BuyPrice ) * NumOfShares;





 





(where sellprice is either sellprice or shortprice, and buyprice is
either buyprice or coverprice)





 





Your 





SellPrice = 44.46  (one bar delay from short signal)





BuyPrice = 45.84 (the bar at which equity is calculated)





 





Profit ( 44.46 - 45.84 ) * <span
>224.921 = -310.3910





 





Now your equity at entry = 10000





so equity at "yellow" line = 10000 + Profit = 10000 -
310.3910 = 9689.61





 







Best regards,
Tomasz Janeczko
amibroker.com







----- Original Message ----- 





<span
>From:<font
size=2 face=Arial> <a
href="" title="dingo@xxxxxxxxxx">dingo 





To:<font size=2
face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">_amibroker_yahoo
; tj@xxxxxxxxxxxxx






Sent:<font size=2
face=Arial> Friday, May 16,
2003 9:49 PM





Subject:<font size=2
face=Arial> [amibroker]
Calculation of Equity and Drawdowns - trying to understand what's going on..





 





Please help me
understand how Amibroker calculates equity and drawdowns!!

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

Here are my settings:

Settings:   Delay = 1, Open for all signals
                
No interest, no commissions,  drawdown figures based on: worst case

-----------------------------------------------------------------------------------
And here is the Afl Used to produce the csv data which is below the formula:





{buy/sell etc. goes here}






E = Equity();

Filter=1;

BIR      = IIf(Status("BarInRange") > 0,
1, 0);

CurEq    = Equity();
MaxEq    = Highest(CurEq);

CurDD    = IIf(BIR, 100 * (MaxEq - CurEq) / MaxEq, 0);
MaxDD    = Highest(CurDD);

AddColumn(Buy,"Buy",1.0);
AddColumn(Sell,"Sell",1.0);
AddColumn(Short,"Short",1.0);
AddColumn(Cover,"Cover",1.0);
AddColumn(O, "Open",1.2);
AddColumn(L, "Low",1.2);
AddColumn(H, "High",1.2);
AddColumn(C, "Close",1.2);

AddColumn(MaxEq,"MaxEq",1.2);
AddColumn(CurEq,"Equity()",1.2);
AddColumn(-CurDD,"CDD%",1.2);
AddColumn(-MaxDD,"MDD%",1.2);





 





<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=672
  u1:str>
 
 
  
  Ticker
  
  
  Date/Time
  
  
  Buy
  
  
  Sell
  
  
  Short
  
  
  Cover
  
  
  Open
  
  
  Low
  
  
  High
  
  
  Close
  
  
  MaxEq
  
  
  Equity()
  
  
  CDD%
  
  
  MDD%
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37377">
  05/01/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  1
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  43.40
  
  <td height=17 
  u1:num>
  43.00
  
  <td height=17 
  u1:num>
  44.61
  
  <td height=17 
  u1:num>
  44.51
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num>
  0.00
  
  <td height=17 
  u1:num>
  0.00
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37378">
  05/02/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  44.46
  
  <td height=17 
  u1:num>
  44.19
  
  <td height=17 
  u1:num>
  45.19
  
  <td height=17 
  u1:num>
  44.48
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num>
  0.00
  
  <td height=17 
  u1:num>
  0.00
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37379">
  05/03/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  44.73
  
  <td height=17 
  u1:num>
  44.67
  
  <td height=17 
  u1:num>
  45.19
  
  <td height=17 
  u1:num>
  45.07
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num="9939.27">
  9,939.27
  
  <td height=17 
  u1:num>
  -0.61
  
  <td height=17 
  u1:num>
  -0.61
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37382">
  05/06/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  45.10
  
  <td height=17 
  u1:num>
  44.71
  
  <td height=17 
  u1:num>
  45.50
  
  <td height=17 
  u1:num>
  44.71
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num="9856.05">
  9,856.05
  
  <td height=17 
  u1:num>
  -1.44
  
  <td height=17 
  u1:num>
  -1.44
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37383">
  05/07/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  44.70
  
  <td height=17 
  u1:num>
  44.60
  
  <td height=17 
  u1:num>
  45.36
  
  <td height=17 
  u1:num>
  45.17
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num="9946.02">
  9,946.02
  
  <td height=17 
  u1:num>
  -0.54
  
  <td height=17 
  u1:num>
  -1.44
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37384">
  05/08/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  45.32
  
  <td height=17 
  u1:num>
  45.00
  
  <td height=17 
  u1:num>
  45.79
  
  <td height=17 
  u1:num>
  45.79
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num="9806.57">
  9,806.57
  
  <td height=17 
  u1:num>
  -1.93
  
  <td height=17 
  u1:num>
  -1.93
  
 
 
  
  AD
  
  
  05/09/2002
  
  
  0
  
  
  0
  
  
  0
  
  
  0
  
  
  45.84
  
  
  44.80
  
  
  45.84
  
  
  44.80
  
  
  10,000.00
  
  
  9,689.61
  
  
  -3.10
  
  
  -3.10
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37386">
  05/10/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  1
  
  <td height=17 
  u1:num>
  44.84
  
  <td height=17 
  u1:num>
  43.76
  
  <td height=17 
  u1:num>
  44.84
  
  <td height=17 
  u1:num>
  43.88
  
  <td height=17 
  u1:num="10000">
  10,000.00
  
  <td height=17 
  u1:num="9914.53">
  9,914.53
  
  <td height=17 
  u1:num>
  -0.85
  
  <td height=17 
  u1:num>
  -3.10
  
 
 
  
  AD
  
  <td height=17 
  u1:num="37389">
  05/13/2002
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  0
  
  <td height=17 
  u1:num>
  43.88
  
  <td height=17 
  u1:num>
  43.51
  
  <td height=17 
  u1:num>
  44.09
  
  <td height=17 
  u1:num>
  43.90
  
  <td height=17 
  u1:num="10130.46">
  10,130.46
  
  <td height=17 
  u1:num="10130.46">
  10,130.46
  
  <td height=17 
  u1:num>
  0.00
  
  <td height=17 
  u1:num>
  -3.10
  
 
 
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
 
 
  
  <span
  > 
  
  
  224.921 shares
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
  
  <span
  > 
  
 






 





The trade in the above is a Short and the results are from
an Exploration.





 





The line I'm interested in is the yellow one.  How did
the equity() calc come up with 9,689.61?  





 





Thanks for any/all explanations!!





 





d





Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<font size=2
face="Courier New">
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx 
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Your use of
Yahoo! Groups is subject to the Yahoo!
Terms of Service. 




Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<font size=2
face="Courier New">
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx 
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Your use of
Yahoo! Groups is subject to the Yahoo!
Terms of Service. 










Yahoo! Groups Sponsor


  ADVERTISEMENT









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.