Maximum Intraday Drawdown
----------------------------------------
 
Months ago we had a discussion about drawdowns. Eventually I had time to 
take a closer look at it.
 
After inspecting the code, I have come to the conclusion that the figures 
presented under the heading 'Max DD' are actually 'Max EndOfDay Losses', 
and, in the case of two or more successive negative days, I think it would 
show the cumulated loss for that period (although I have not examined this 
in detail).
 
After having experienced some intraday drawdowns, I wanted to know what the 
actual intraday drawdowns for a longer backtest period would be. I have 
found that, for the typical anti-trend strategies that are presented here, 
these drawdowns are 2-3 times higher than the reported 'Max EndOfDay 
Losses' under the heading 'Max DD'.
 
This is not meant to criticise JBookTrader, but just to make a great 
product even better.
 
If you want to check the actual maximum drawdowns of your strategies, 
you might want to implement the following changes:
 
(1) In Strategy.java, method 'processInstant(...)', replace
 
      onBookSnapshot();
      positionManager.trade();
by
 
      onBookSnapshot();

      //AB Begin July 4, 2013 - in order to update drawdown
      int position = positionManager.getCurrentPosition();
      if (position != 0) 
         
performanceManager.updatePositionValue(getMarketBook().getSnapshot().getPrice(),
 
position);
      //AB End

      positionManager.trade();
 
(2) In PerformanceManager.java, replace
 
      private double peakNetProfit, maxDrawdown;
by
 
      private double peakNetProfit, maxDrawdown, currentDrawdown;
 
(3) In PerformanceManager.java, replace
 
    public void updatePositionValue(double price, int position) {
        positionValue = position * price * multiplier;
    }
 
by
 
    public void updatePositionValue(double price, int position) {
        positionValue = position * price * multiplier;

        //AB Begin July 4, 2013 : calculate drawdown
        netProfit = getNetProfit();
        if (netProfit > peakNetProfit)  peakNetProfit = netProfit;
        else {
           currentDrawdown = peakNetProfit - netProfit;
           if (currentDrawdown > maxDrawdown) maxDrawdown = currentDrawdown;
        }
        //AB End
       
    }
 
(4) In PerformanceManager.java, method updateOnTrade, comment out the two 
lines in the middle
 
       //AB Begin July 4, 2013 - drawdown calculated elsewhere, obsolete 
statements
       //peakNetProfit = Math.max(netProfit, peakNetProfit);
       //maxDrawdown = Math.max(maxDrawdown, peakNetProfit - netProfit);
       //AB End
Eugene mentioned elsewhere that he has not implemented actual intraday 
drawdown because of optimizing performance impacts. I could not confirm 
this so far. However, as drawdown is calculated only while a position is 
open, i.e. about 3% of the time, I believe and hope that it will not have a 
big influence.
 
Eugene, would you please take a look to see if these modifications 
are correct. Thank you!
 

-- 
You received this message because you are subscribed to the Google Groups 
"JBookTrader" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jbooktrader.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to