Class EquityCurveStats
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
Calculates comprehensive performance statistics on an equity curve
[ProtoContract]
[ProtoInclude(96, typeof(PerformanceStats))]
public class EquityCurveStats : TradeStats
- Inheritance
-
EquityCurveStats
- Derived
- Inherited Members
- Extension Methods
Properties
AnnualTurnover
Gets annual turnover as a percent of average account value.
public double AnnualTurnover { get; }
Property Value
ArithmeticSharpeRatio
Gets the Sharpe Ratio using an arithmetic rather than geometric annualized return.
public double ArithmeticSharpeRatio { get; }
Property Value
AvgAccountValue
Gets the average value of account equity.
public double AvgAccountValue { get; }
Property Value
AvgDrawdown
Gets the average of all drawdowns.
public double AvgDrawdown { get; }
Property Value
AvgMaxRetracement
Gets the average maximum retracement (see Schwager).
public double AvgMaxRetracement { get; }
Property Value
AvgOfTop5Drawdowns
Gets the average of the worse five percentage drawdowns.
public double AvgOfTop5Drawdowns { get; }
Property Value
AvgReturn
Gets the mean return.
public double AvgReturn { get; }
Property Value
AvgYearlyDrawdown
Gets the average yearly maximum drawdown.
public double AvgYearlyDrawdown { get; }
Property Value
CAGR
Gets the compound annual growth rate.
public double CAGR { get; }
Property Value
ConditionalSharpe
Gets a Sharpe Ratio calculated using conditional VaR (expected tail loss) in the denominator.
public double ConditionalSharpe { get; }
Property Value
ConditionalVaR
Gets the conditional Value-at-Risk (expected tail loss).
public double ConditionalVaR { get; }
Property Value
ConfidenceLevel
Gets/sets the confidence level used in the VaR calculations.
public double ConfidenceLevel { get; set; }
Property Value
DownsideDeviation
Gets the annualized downside or semideviation below TargetReturn.
public double DownsideDeviation { get; }
Property Value
Drawdowns
Gets a collection of all equity drawdowns.
public DrawdownCollection Drawdowns { get; }
Property Value
EndDate
Gets the last date in the equity curve.
public DateTime EndDate { get; }
Property Value
EndingAccountValue
Gets the ending account value.
public double EndingAccountValue { get; }
Property Value
GainToPainRatio
Gets Schwager's Gain To Pain Ratio (sum of monthly returns / abs value of monthly losses).
public double GainToPainRatio { get; }
Property Value
HistoricalVaR
Gets the historical Value-at-Risk.
public double HistoricalVaR { get; }
Property Value
Iterations
Gets/sets the number of iterations used to resample the return stream.
public int Iterations { get; set; }
Property Value
KRatio
Gets the Kestner Ratio, a measure of equity curve smoothness.
public double KRatio { get; }
Property Value
LongestDrawdownEndDate
Gets the date on which a new equity high was achieved after the longest drawdown.
public DateTime LongestDrawdownEndDate { get; }
Property Value
LongestDrawdownPeriods
Gets the number of business days of the longest drawdown.
public int LongestDrawdownPeriods { get; }
Property Value
LongestDrawdownStartDate
Gets the beginning date of the longest drawdown.
public DateTime LongestDrawdownStartDate { get; }
Property Value
LongestFlatEndDate
Gets the date on which a new equity high is made after the longest flat period in equity.
public DateTime LongestFlatEndDate { get; }
Property Value
LongestFlatPeriods
Gets the number of business days of the longest flat period in equity.
public int LongestFlatPeriods { get; }
Property Value
LongestFlatStartDate
Gets the start date of the longest flat period in equity.
public DateTime LongestFlatStartDate { get; }
Property Value
MARRatio
Gets the Managed Accounts Report ratio (CAGR / MaxDrawdownPercent).
public double MARRatio { get; }
Property Value
MaxAccountValue
Gets the maximum account value achieved.
public double MaxAccountValue { get; }
Property Value
MaxDrawdown
Gets the maximum point drawdown.
public double MaxDrawdown { get; }
Property Value
MaxDrawdownDate
Gets the date on which the max point drawdown was observed.
public DateTime MaxDrawdownDate { get; }
Property Value
MaxDrawdownPercent
Gets the maximum percentage drawdown.
public double MaxDrawdownPercent { get; }
Property Value
MaxDrawdownPercentDate
Gets the date on which the maximum percentage drawdown was observed.
public DateTime MaxDrawdownPercentDate { get; }
Property Value
MaxReturn
Gets the max period return.
public double MaxReturn { get; }
Property Value
MinAccountValue
Gets the minimum account value suffered.
public double MinAccountValue { get; }
Property Value
MinReturn
Gets the min period return.
public double MinReturn { get; }
Property Value
MonthlySharpe
Gets the Sharpe Ratio calculated on monthly data.
public double MonthlySharpe { get; }
Property Value
NetPnL
Gets the net P&L (ending account value - startup cash). This includes interest, dividends, commissions, etc.
public override double NetPnL { get; }
Property Value
NewHighs
Gets the number of new equity highs achieved.
public int NewHighs { get; }
Property Value
NewHighsPercent
Gets the percent of days a new equity high was achieved.
public double NewHighsPercent { get; }
Property Value
OmegaRatio
Gets the Omega ratio.
public double OmegaRatio { get; }
Property Value
PeakRatio
Gets the peak ratio (inverse of Seykota's Lake Ratio).
public double PeakRatio { get; }
Property Value
Periodicity
Gets/sets the periodicity of the equity curve.
public Periodicity Periodicity { get; set; }
Property Value
PeriodsInDrawdown
Gets the number of days spent in drawdown.
public int PeriodsInDrawdown { get; }
Property Value
PeriodsInDrawdownPercent
Gets the number of days in drawdown as a percent of total days.
public double PeriodsInDrawdownPercent { get; }
Property Value
PeriodsLosing
Gets the number of losing days.
public int PeriodsLosing { get; }
Property Value
PeriodsLosingPercent
Gets the percent of losing days.
public double PeriodsLosingPercent { get; }
Property Value
PeriodsPerYear
Used to annualize standard deviation based on number of periods per year (e.g. 12 for monthly data).
public int PeriodsPerYear { get; }
Property Value
PeriodsWinning
Gets the number of winning days.
public int PeriodsWinning { get; }
Property Value
PeriodsWinningPercent
Gets the percent of winning days.
public double PeriodsWinningPercent { get; }
Property Value
RAD
Gets the Returns adjusted for drawdowns aka Keller Ratio. See Breadth Momentum and Vigilant Asset Allocation (https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3002624).
public double RAD { get; }
Property Value
ROI
Gets the return on investment.
public double ROI { get; }
Property Value
RSquared
Gets the R-squared value of a linear regression on the log equity curve.
public double RSquared { get; }
Property Value
ResampledMAR
Gets the MAR ratio used resampled max drawdown in the denominator.
public double ResampledMAR { get; }
Property Value
ResampledMaxDrawdown
Gets the average max dradown from boostrapped daily return stream.
public double ResampledMaxDrawdown { get; }
Property Value
ReturnRetracementRatio
Gets Schwager's Return Retracement Ratio (CAGR - RiskFreeRate) / AvgMaxRetracement.
public double ReturnRetracementRatio { get; }
Property Value
RiskFreeRate
Gets/sets the risk free interest rate. Value should be expressed in decimal form (e.g. 5% = 0.05).
public double RiskFreeRate { get; set; }
Property Value
SDSharpeRatio
Gets the Symmetric Downside-Risk Sharpe Ratio. See Schwager's "Market Sense and Nonsense: How the Markets Really Work (and How They Don't)".
public double SDSharpeRatio { get; }
Property Value
SharpeRatio
Gets the Sharpe Ratio (CAGR - RiskFreeRate)/Annualized Std Dev.
public double SharpeRatio { get; }
Property Value
Skew
Gets the skew.
public double Skew { get; }
Property Value
SortinoRatio
Gets the Sortino ratio (CAGR - TargetReturn) / DownsideDeviation.
public double SortinoRatio { get; }
Property Value
StandardDeviation
Gets the standard deviation of daily returns.
public double StandardDeviation { get; }
Property Value
StartDate
Gets the first date in the equity curve.
public DateTime StartDate { get; }
Property Value
StartupCash
Gets the starting cash balance.
public double StartupCash { get; }
Property Value
TailRatio
Gets the tail ratio [95th percentile of daily returns / Abs(5th percentile)].
public double TailRatio { get; }
Property Value
TargetReturn
Gets/sets the target or minimum acceptable return. Value should expressed as an annual rate in decimal form (e.g. 2% = 0.02). Used the Omega and Sortino ratio calculations.
public double TargetReturn { get; set; }
Property Value
TotalPeriods
Gets the total number of periods in the money management test expressed in whatever units Periodicity is in.
public int TotalPeriods { get; }
Property Value
UlcerIndex
Gets the Ulcer Index, a measure of drawdown severity.
public double UlcerIndex { get; }
Property Value
UlcerPerformanceIndex
Gets the Ulcer Performance aka Martin Index (CAGR - RiskFreeRate)/Ulcer Index * 100.
public double UlcerPerformanceIndex { get; }
Property Value
VaR
Gets the parametric Value-at-Risk in percentage terms.
public double VaR { get; }
Property Value
Volatility
Gets the annualized standard deviation (std dev * Sqrt(PeriodsPerYear))
public double Volatility { get; }
Property Value
Methods
Calculate(TimeSeries)
Calculates statistics using the specified equity curve. Note this uses dollar values, not returns. Convert a return series to an equity curve using Indicators.Vami before using.
public void Calculate(TimeSeries equityCurve)
Parameters
equityCurve
TimeSeries
GetDailyReturns()
Returns a timeseries of the daily returns.
public TimeSeries GetDailyReturns()
Returns
GetEquityCurve()
Returns a timeseries of the daily equity curve.
public TimeSeries GetEquityCurve()
Returns
GetMonthlyPerformanceGrid()
Returns a matrix of monthly returns suitable for display with year in first column and annual returns in the last column.
public double[,] GetMonthlyPerformanceGrid()
Returns
- double[,]
GetMonthlyReturns()
Returns a timeseries of monthly returns.
public TimeSeries GetMonthlyReturns()
Returns
OnCalculate(TimeSeries)
Performs the equity curve calculations.
protected virtual void OnCalculate(TimeSeries equityCurve)
Parameters
equityCurve
TimeSeries