[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRo
Brought to you by:
glauco_1
|
From: <gla...@us...> - 2003-11-09 19:44:43
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
In directory sc8-pr-cvs1:/tmp/cvs-serv13129/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
Added Files:
MaxEquityDrawDown.cs
Log Message:
First version for the max drawdown calculation
--- NEW FILE: MaxEquityDrawDown.cs ---
using System;
using System.Data;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class MaxEquityDrawDown : SummaryRow
{
private Summary summary;
private double drawDown;
private double maxEquityValue;
private void updateDrawDownForCurrentRow( DataRow dataRow )
{
this.maxEquityValue = Math.Max( this.maxEquityValue , (double)dataRow[ "AccountValue" ] );
this.drawDown =
Math.Max( this.drawDown , this.maxEquityValue - (double)dataRow[ "AccountValue" ] );
}
private void setDrawDown()
{
drawDown = 0.0;
maxEquityValue = double.MinValue;
foreach ( DataRow row in summary.AccountReport.Equity.DataTable.Rows )
updateDrawDownForCurrentRow( row );
}
public MaxEquityDrawDown( Summary summary )
{
this.summary = summary;
this.rowDescription = "Max equity drawdown (%)";
setDrawDown();
this.rowValue = this.drawDown/this.maxEquityValue*100;
}
}
}
|