PureBytes Links
Trading Reference Links
|
Paul,
Do you use "OLD" or "NEW" backtester? There are differences how those
two calculate drawdowns
By default old backtester calculates it using High-Low range and this gives
bigger drawdown then
checking only 'close' price (as your calculations do).
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Paul Ho
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, January 18, 2004 6:00
AM
Subject: RE: [amibroker] Max Trade
drawdown
<SPAN
class=836523104-18012004>Thank you Hermand and Dave, but I dont think that
would give me drawdown.
Max
drawdown is defined by the largest peak to valley decline experienced in any
single trade.
But
Herman your code has inspired me to try the following:
<SPAN
class=836523104-18012004>------------------------------------------------------
<FONT
color=#0000ff>Filter=Buy OR
Sell;
<FONT
size=2>eq=Equity(<SPAN
class=836523104-18012004>0);<FONT
size=1>
<SPAN
class=836523104-18012004>heq=HighestSince(Buy,eq);<FONT
size=1>
<SPAN
class=836523104-18012004>leq=LowestSince(Buy,<SPAN
class=836523104-18012004>eq);
<FONT face=Arial
color=#0000ff size=2>dr=heq-leq;
<FONT face=Arial
color=#0000ff
size=2>--------------------------------------------------------<FONT
size=1>
<TABLE cellSpacing=0
cellPadding=0 width=547 border=0 x:str>
<COL
width=99>
<COL
span=2 width=0>
<TD
width=64 height=17>Ticker
<TD
width=99>Date/Time
<TD
width=64>Buy
<TD
width=64>Sell
<TD
width=64>equity
<TD
width=64>heq
<TD
width=64>leq
<TD
width=64>Dr
<TD
height=17>ALL
<TD class=xl22
align=right x:num="36587">2/03/2000
<TD
align=right x:num>0
<TD
align=right x:num>1
<TD
align=right x:num="148048.23">148048.2
<TD
align=right x:num="174174.17">174174.2
<TD
align=right x:num="148048.23">148048.2
<TD
align=right x:num>26125.94
<TD class=xl23
height=17>ALL
<TD class=xl24
align=right x:num="36592">7/03/2000
<TD class=xl23
align=right x:num>0
<TD class=xl23
align=right x:num>1
<TD class=xl23
align=right x:num="143956.66">143956.7
<TD class=xl23
align=right x:num="174174.17">174174.2
<TD class=xl23
align=right x:num="143956.66">143956.7
<TD class=xl23
align=right x:num="30217.52"><FONT face=Arial
size=2>30217.52
<TD
height=17>ALL
<TD class=xl22
align=right x:num="36598">13/03/2000
<TD
align=right x:num>0
<TD
align=right x:num>1
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="174174.17">174174.2
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="30217.52"><FONT face=Arial
size=2>30217.52
<TD
height=17>ALL
<TD class=xl22
align=right x:num="36612">27/03/2000
<TD
align=right x:num>0
<TD
align=right x:num>1
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="174174.17">174174.2
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="30217.52"><FONT face=Arial
size=2>30217.52
<TD
height=17>ALL
<TD class=xl22
align=right x:num="36650">4/05/2000
<TD
align=right x:num>0
<TD
align=right x:num>1
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="174174.17">174174.2
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="30217.52"><FONT face=Arial
size=2>30217.52
<TD
height=17>ALL
<TD class=xl22
align=right x:num="36679">2/06/2000
<TD
align=right x:num>0
<TD
align=right x:num>1
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="174174.17">174174.2
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="30217.52"><FONT face=Arial
size=2>30217.52
<TD
height=17>ALL
<TD class=xl22
align=right x:num="36699">22/06/2000
<TD
align=right x:num>1
<TD
align=right x:num>0
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num="143956.66">143956.7
<TD
align=right x:num>0
<TD
height=17>ALL
<TD class=xl22
align=right x:num="36710">3/07/2000
<TD
align=right x:num>1
<TD
align=right x:num>0
<TD
align=right x:num="144272.95">144273
<TD
align=right x:num="144272.95">144273
<TD
align=right x:num="144272.95">144273
<TD
align=right x:num><FONT face=Arial
size=2>0
<FONT face=Arial color=#0000ff
size=2>
The
lowest drawdown in the trade list is indeed 30127.52. However, you all
know that backtester takes the first sell signal and ignore the rest.
the
correct max drawdown backtester should report should be identical if we
instead you the following
<SPAN
class=836523104-18012004>------------------------------------------------------
<SPAN
class=836523104-18012004>
<FONT
color=#0000ff>Filter=Buy OR
Sell;
<FONT
size=2>eq=Equity(<SPAN
class=836523104-18012004>1);<SPAN
class=836523104-18012004> //this change should reflect
backtester
<SPAN
class=836523104-18012004>heq=HighestSince(Buy,eq);<FONT
size=1>
<SPAN
class=836523104-18012004>leq=LowestSince(Buy,<SPAN
class=836523104-18012004>eq);
<FONT face=Arial
color=#0000ff size=2>dr=heq-leq;
<FONT face=Arial
color=#0000ff
size=2>--------------------------------------------------------
<FONT face=Arial color=#0000ff
size=2>
<TABLE cellSpacing=0
cellPadding=0 width=547 border=0 x:str>
<COL
width=99>
<COL
span=2 width=0>
<TD
width=64 height=17>Ticker
<TD
width=99>Date/Time
<TD
width=64>Buy
<TD
width=64>Sell
<TD
width=64>equity
<TD
width=64>heq
<TD
width=64>leq
<TD
width=64>Dr
<TD class=xl25
height=17>ALL
<TD class=xl26
align=right x:num="36587">2/03/2000
<TD class=xl25
align=right x:num>0
<TD class=xl25
align=right x:num>1
<TD class=xl25
align=right x:num="148048.23">148048.2
<TD class=xl25
align=right x:num="174174.17">174174.2
<TD class=xl25
align=right x:num="148048.23">148048.2
<TD class=xl25
align=right x:num><FONT
size=2>26125.94<SPAN
class=836523104-18012004><FONT face=Arial color=#0000ff
size=2>
<FONT
size=1>
<SPAN
class=836523104-18012004><FONT
face=Tahoma><FONT face=Arial
color=#0000ff>As far as I know, the max draw down should be
26,125.94 instead of 30,217.52 as the backtester should have sold at the
first sell signal.
<FONT
face=Arial color=#0000ff>Am I correct or I have missed something?
Can somebody shed some light on this?
<SPAN
class=836523104-18012004>
<SPAN
class=836523104-18012004>Paul.
<SPAN
class=836523104-18012004><FONT
size=2>
<SPAN
class=836523104-18012004>
<SPAN
class=836523104-18012004>
<SPAN
class=836523104-18012004>
<SPAN
class=836523104-18012004>
<SPAN
class=836523104-18012004> -----Original
Message-----From: Herman vandenBergen [mailto:psytek@xxxxxxxx]
Sent: Sunday, 18 January 2004 1:19 PMTo:
amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] Max Trade
drawdown
<FONT face=Arial color=#0000ff
size=2>You could have a look at your trade profits, I like to plot
with something like this (not verified):
<FONT face=Arial color=#0000ff
size=2>
<FONT
color=#ff0000>Buy=<FONT
color=#0000ff>Cross( <FONT
color=#0000ff>MACD(), <FONT
color=#0000ff>Signal<FONT
color=#000000>() ); Sell<FONT
color=#000000> = Cross<FONT
color=#000000>( Signal<FONT
color=#000000>(), MACD<FONT
size=2>() ); <FONT
color=#ff0000>Short = <FONT
color=#ff0000>Sell<FONT
face=Arial>; <FONT
color=#ff0000>Cover = <FONT
color=#ff0000>Buy<FONT
face=Arial>; E=<FONT
color=#0000ff>Equity(<FONT
color=#ff00ff>0<FONT
color=#000000>); LongProfit = IIf<FONT
color=#000000>(Ref<FONT
color=#000000>(Sell<FONT
color=#000000>,-1),E -
ValueWhen(<FONT
color=#0000ff>Ref(<FONT
color=#ff0000>Buy,-<FONT
color=#ff00ff>1),E),<FONT
color=#ff00ff>0)/<FONT
color=#0000ff>ValueWhen(<FONT
color=#0000ff>Ref(<FONT
color=#ff0000>Buy,-<FONT
color=#ff00ff>1),E)*<FONT
color=#ff00ff>100<FONT
color=#000000>; ShortProfit = IIf<FONT
color=#000000>(Ref<FONT
color=#000000>(Cover<FONT
color=#000000>,-1<FONT
color=#000000>),E-ValueWhen<FONT
color=#000000>(Ref<FONT
color=#000000>(Short<FONT
color=#000000>,-1<FONT
color=#000000>),E),0<FONT
color=#000000>)/ValueWhen<FONT
color=#000000>(Ref<FONT
color=#000000>(Short<FONT
color=#000000>,-1<FONT
color=#000000>),E)*100<FONT
size=2>; LowestLongProfit =
LastValue(<FONT
color=#0000ff>Lowest<FONT
color=#000000>(LongProfit)); LowestShortProfit = <FONT
color=#0000ff>LastValue(<FONT
color=#0000ff>Lowest<FONT
color=#000000>(ShortProfit)); <FONT
color=#0000ff>Plot(LongProfit,<FONT
color=#ff00ff>"LongProfit",<FONT
color=#ff00ff>5,<FONT
color=#ff0000>styleArea<FONT
face=Arial>); <FONT
color=#0000ff>PlotShapes<FONT
color=#000000>((LowestLongProfit==LongProfit)*<FONT
color=#ff0000>shapeUpArrow,<FONT
color=#ff0000>colorGreen<FONT
face=Arial>); <FONT
color=#0000ff>Plot(ShortProfit,<FONT
color=#ff00ff>"ShortProfit",<FONT
color=#ff00ff>4,<FONT
color=#ff0000>styleArea<FONT
face=Arial>); <FONT
color=#0000ff>PlotShapes<FONT
color=#000000>((LowestShortProfit==ShortProfit)*<FONT
color=#ff0000>shapeDownArrow,<FONT
color=#ff0000>colorRed<FONT
face=Arial>); <FONT
color=#ff0000>GraphXSpace = <FONT
color=#ff00ff>5
<FONT face=Arial color=#ff00ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Good luck,
<FONT face=Arial color=#0000ff
size=2>herman
<FONT face=Arial
size=2>-----Original Message-----From: Paul Ho
[mailto:paultsho@xxxxxxxxxxxx]Sent: January 18, 2004 9:23
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker]
Max Trade drawdown
<SPAN
class=292511801-18012004>Hi,
I have a very
simple question which i dont seem to be able to find answers
for
How do I
identify the trade that cause the max trade drawdown in the backtesting
report (portfolio test). I tried using the
the MFE &
the MAE e.g
<SPAN
class=292511801-18012004>Drawdown=IF(loser, (MFE-MAE)*position); but
none of the trade matches.
Thanks in
advance.
<SPAN
class=292511801-18012004>Paul.<FONT
face=Arial size=2>Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend
SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT
face=Arial size=2>--------------------------------------------Check
group FAQ at: <A
href=""><FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
size=2>
Yahoo! Groups Links
To visit your group on the web, go
to:<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/<FONT
face=Arial size=2>
To unsubscribe from this group, send an
email to:<A
href=""><FONT
face=Arial
size=2>amibroker-unsubscribe@xxxxxxxxxxxxxxx<FONT
face=Arial size=2>
Your use of Yahoo! Groups is subject to the
<FONT face=Arial
size=2>Yahoo! Terms of Service.
Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend 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
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend 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
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
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
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|