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

[amibroker] Re: Steve Dugas



PureBytes Links

Trading Reference Links

That's hardly what I'd call a calculation of MaxDD ... 

1.  MaxDD% need not have anything to do with MaxDD Points
2.  MaxDD% has nothing to do with initial equity
3.  MaxDD% does have to do with prices that occur during the course 
of the trade not just at the end.

--- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxxx> wrote:
> Hi Steve,
> 
> These are max drawdown/points and max drawdown/percent 
respectively, from your initial equity. The DLL calculates a bunch of 
statistics at the close of each trade, one of which  is Lowest 
Equity. This variable is initialized to Initial Equity, and at the 
close of each trade, it checks to see if your current equity is less 
than the current Lowest Equity. If so, it is replaced with the new 
low. After all testing is done, it calculates:
> 
>   MaxDrawdownPoints = LowestEquity - InitEquity
>   MaxDrawdownPercent = 100 * MaxDrawdownPoints / InitEquity
> 
> (Since it is calculated only when closing a trade, it is possible 
that your max drawdown "on paper" during an open position could have 
been greater.)
> 
>  Since you are looking at the results from the optimal parameters, 
it is probably not too surprising that many stocks show zero 
drawdown. Many of the results have 100% winning trades. Others have 
losing trades, but they come later so you are losing profits rather 
than initial equity. On a few, you actually lose part of your initial 
equity at some point, which is what you are seeing.
> 
> Steve
>   ----- Original Message ----- 
>   From: Stephen Almond (F) 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Monday, April 07, 2003 9:34 AM
>   Subject: Re: [amibroker] Steve Dugas
> 
> 
>   Steve,
> 
>   When I run one of your indicators against a group of stocks using 
Explore, most of them show 'Max $ DD' and 'Max % DD' as zero. A few 
show non-zero values. Any idea why this is? Here is my include file, 
in case this gives a clue:
> 
>   TestBars    =126;       // bars in testperiod (most recent bars)
>   StartDate   = 991231; // start date for earlier test period
>   EndDate     = 0;       // end date for earlier test period
>   GoLong      = 1;       // 1 = take long positions, 0 = no long 
positions
>   GoShort     = 1;       // 1 = take short positions, 0 = no short 
positions
>   SignalPrice = Close;   // array used for trade signals and 
plotting indicator
>   TradeDelay  = 1;       // bars after trade signal to execute trade
>   TradePrice  = Open;    // array used for trade executions
>   InitEquity  = 100000;   // initial equity
>   ReInvest    = 1;       // 1 = initial equity, 2 = compounded 
equity
>   CommAmount  = 0.5;      // commission amount
>   CommType    = 2;       // 1 = $/trade, 2 = %/trade, 3 = c/share
>   EnterBarOne = 1;       // 1 = always open trade on 1st test bar, 
0 = don't
>   OptimizeBy  = 1;       // 1 = annual % return, 2 = peak equity at 
close/all trades
>                          // 3 = % winning trades, 4 = avg % 
return/trade
>                          // 5 = % return/worst trade, 6 = 
drawdown/starting equity
> 
>   Also AB settings use n and n=1
> 
>   Thanks,
> 
>   Steve
>     ----- Original Message ----- 
>     From: Steve Dugas 
>     To: amibroker@xxxxxxxxxxxxxxx 
>     Sent: Saturday, April 05, 2003 4:13 AM
>     Subject: Re: [amibroker] Steve Dugas
> 
> 
>     Hi Stephen - Thank you for the kind words. Please see my 
replies to your
>     questions below:
> 
>     ----- Original Message -----
>     From: "Stephen Almond (T)" <s.almond@xxxx>
>     To: "Ami" <amibroker@xxxxxxxxxxxxxxx>
>     Sent: Friday, April 04, 2003 5:15 AM
>     Subject: [amibroker] Steve Dugas
> 
> 
>     > Steve, congratulations on you excellent .DLL. I would like to 
make a
>     couple
>     > of comments:
>     >
>     > 1. On the attached chart of your TRIX indicator, the buy/sell 
signals seem
>     > too good to be true. Seems the programme picks the peak 
before the
>     > subsequent down day which defines that peak (same for 
troughs, of course).
>     > Can you introduce a couple of days delay to make the trades 
more 'real'?
>     >
> 
>     The chart shows the trade signals while the reported results 
are based on
>     the actual trades. TRIX uses a reversal system, so the 
indicator will change
>     color on the day that it reverses - you can confirm this by 
hovering the
>     cursor over the day that it changes color, and also the 2 days 
before, and
>     reading the values in the tool tips. I deliberately programmed 
the charts to
>     show the signals so that it would alert me to signals on the 
current bar.
>     Actually, the signal is given on the day that the DOT (not the 
line) changes
>     color. I added the dots because in line mode, AB uses the new 
color to
>     connect the signal bar to the previous bar,  possibly giving 
the impression
>     that the signal occurred the day before it actually did. In 
real time it
>     doesnt matter because the color change for the latest bar will 
will show up
>     on the dot and the line at the same time, but when looking at 
past signals,
>     it is the first DOT of a new color that signals the reversal.
> 
>     You can select when the actual trades take place, similar to AA 
settings, by
>     setting the TradePrice and TradeDelay variables at the top of 
the code. They
>     are preset to execute the trade on the open of the day 
following the signal,
>     but for example, if your style is to trade at the close on the 
day of the
>     signal,  just change TradePrice to "Close" and TradeDelay 
to "0".
> 
>     > 2. I notice that if I use 63 days (~1/4 year) for my Testbars 
and get a
>     > return of 12%, then the Annual return is shown as 48%. Is the 
lack of
>     > compounding correct, or are you simply erring on the 
conservative side?
> 
>     The program uses 2 methods to figure annual return, one if you 
are
>     reinvesting initial equity and the other if you are reinvesting 
compounded
>     equity. If you want to reinvest compounded equity (and also 
calculate annual
>     return based on this method), just set ReInvest variable to "2".
> 
>     >
>     > 3. I note in you help document that you say the backtest 
isn't completely
>     > consistent with the explorations. Do you hope to remedy this? 
As an
>     example
>     > if I use testbars =126, should I be able to backtest over 126 
bars and at
>     > least get the same number of trades as indicated by the 
exploration?
>     >
> 
>     Well, actually, the DLL has its own built-in backtester, which 
it runs when
>     you do an exploration. That is how it determines the optimal 
parameters - it
>     tests all combinations you select and returns the most 
profitable one. I
>     dont think that the results will ever be identical to AB's 
backtester
>     because there are a number of variables to consider and I dont 
know exactly
>     how Tomasz handles them all in his code. For example, AB 
calculates interest
>     when you are out of the market - I didnt bother to add interest 
in the DLL
>     because it seems like a relatively minor amount these days, but 
maybe I will
>     add it in the future. Another example is if you choose to 
reinvest initial
>     equity, the DLL will actually reinvest the lesser of initial 
equity or
>     actual equity (in case you lose money on the first trade for 
example, this
>     is more realistic) I think this would correspond to using  
AB "positionsize"
>     with "allow shrinking" turned on . Another example is that the 
DLL allows
>     you to open a trade on the first bar of the test period if you 
want to,
>     rather than wait for the first signal to occur. If you select 
this method,
>     it will look backwards from the 1st test bar to find the 
previous signal and
>     then enter the trade on the 1st bar of the test period. I added 
this because
>     I usually concentrate on what the stock has been doing very 
recently and if
>     some stocks make me wait for half the test period before 
opening a trade,
>     that makes it hard to make a valid comparison over such a short 
time. To get
>     as close to AB results as possible, you can set all parameters 
to be as
>     close to AB settings as possible. In my limited testing of 
this, I have seen
>     that it is possible to come pretty close.
> 
>     > Thanks for the great programme
> 
>     You are welcome  : - )
> 
>     >
>     >
>     > Send BUG REPORTS to bugs@xxxx
>     > Send SUGGESTIONS to suggest@xxxx
>     > -----------------------------------------
>     > 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 
http://docs.yahoo.com/info/terms/
>     >
>     >
> 
> 
> 
> 
>     Send BUG REPORTS to bugs@xxxx
>     Send SUGGESTIONS to suggest@xxxx
>     -----------------------------------------
>     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. 
> 
> 
>         Yahoo! Groups Sponsor 
>        
>        
> 
>   Send BUG REPORTS to bugs@xxxx
>   Send SUGGESTIONS to suggest@xxxx
>   -----------------------------------------
>   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.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get a FREE REFINANCE QUOTE - click here!
http://us.click.yahoo.com/2CXtTB/ca0FAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/