Backtester
Namespace: WealthLab.Backtest
Parent: Object

The Backtester class is responsible for performing backtest runs in WL8, and returning information about those runs. This document will focus on the Backtester properties that provide performance information about backtest runs, typically for use in the development of ScoreCard or Performance Visualizer extensions.

Backtest Result Properties
BenchmarkBacktestResults
public Backtester BenchmarkBacktestResults

Returns the Backtester instance for the benchmark comparison backtest run. This property might contain null, in which case it is most likely the benchmark backtest itself that is running.


CashCurve
public TimeSeries CashCurve

Returns a TimeSeries instance that represents how much simulated cash was available during the backtest.


CashInterestEarned
public double CashInterestEarned

Returns the total simulated cash interest earned during the backtest.


CommissionPaid
public double CommissionsPaid

Returns the total amount of simulated commission paid in the backtest.


CurrentCash
public double CurrentCash

Returns the simulated cash available at the end of the backtest.


CurrentEquity
public double CurrentEquity

Returns the total equity (capital) at the end of the backtest.


DailyReturns
public TimeSeries DailyReturns

Returns a TimeSeries containing the daily percentage returns of backtest equity curve.


DividendsPaid
public double DividendsPaid

Returns the amount of simulated dividends collected in the backtest. Dividends are captured from EventDataPoint instances in the BarHistory EventDataPoints property with "dividend" in the instance's Name property. Deduping logic is used to ensure that only a single dividend is accounted for each day, even if multiple Event Data Providers that return dividends are enabled.


DrawdownCurve
public TimeSeries DrawdownCurve

Returns a TimeSeries instance of the backtest drawdown, which is the largest peak to trough decline of the equity over time. Drawdown is calculated on a closing price basis, and does not consider highs and lows.


DrawdownPctCurve
public TimeSeries DrawdownPctCurve

Returns a TimeSeries instance of the backtest drawdown percentage, which is the largest peak to trough percentage decline of the equity over time. Drawdown is calculated on a closing price basis, and does not consider highs and lows.


EquityCurve
public TimeSeries EquityCurve

Returns a TimeSeries instance that represents the equity curve of the backtest.


LosingPositions
public PositionList LosingPositions

Returns a PositionList instance containing Position instances for the positions with a net profit less than zero.


MarginInterestPaid
public double MarginInterestPaid

Returns the amount of simulated interest paid for going on margin in the backtest.


MonthlyNegativeReturns
public TimeSeries MonthlyNegativeReturns

Returns a TimeSeries containing the negative monthly percentage returns of the backtest. The negative returns are used when calculating the Sortino Ratio.


MonthlyReturns
public TimeSeries MonthlyReturns

Returns a TimeSeries containing the monthly percentage returns of backtest equity curve.


NetProfit
public double NetProfit

Returns the net profit of the backtest.


NetProfitPct
public double NetProfitPct

Returns the percentage net profit of the backtest.


NSFPositions
public PositionList NSFPositions

Returns a PositionList instance that contains Position instances representing the positions that were flagged as NSF (non-sufficient funds) and thus not included in the performance results. The Backtest still tracks these NSF positions during a backtest so the Strategy's integrity can be maintained. It also issues exit signals for NSF positions, since you might have initiated an entry into an NSF position in your live trading account, even if the Backtester did not have enough simulated capital to enter the trade.


OpenPositionCount
public int OpenPositionCount

Returns the number of currently open position in the backtest, excluding Position instances that were flagged NSF (non-sufficient funds).


OpenPositionCountHistory
public TimeSeries OpenPositionCountHistory

Returns a TimeSeries instance containing the number of open positions over time during the backtest.


OpenPositions
public PositionList OpenPositions

Returns a PositionList instance containing the Position instances for the open positions remaining in backtest. This contains positions that were flagged as NSF (non-sufficient funds) so not included in the performance results.


Orders
public List<Transaction> Orders

Returns a List that contains Transaction instances that represent the orders, or signals, that need to be placed for the Strategy at the next market session.


PositionMetricNames
public List<string> PositionMetricNames

Returns a list of all available Position Metrics for this backtest run. This includes all of the default Position Metrics, such as Profit and BarsHeld, as well as any Strategy assigned PositionMetrics that were the result of calls to Position.SetMetric or Transaction.SetPositionMetric. Typically used by certain Performance Visualizers that deal with Positions, such as the Position Metrics Visualizer in the Power Pack Extension.


Positions
public PositionList Positions

Returns a PositionList instance containing the Position instances for the positions taken during the backtest.


RiskFreeRateOfReturn
public double RiskFreeRateOfReturn

Returns the average percentage return of the 1-year US Treasury yield for the time span of the backtest. Used in calculating Sharpe Ratio and Sortino Ratio in the Basic Scorecard.


TradeHistoryCount
public TimeSeries TradeCountHistory

Returns a TimeSeries instance containing the number of trades at each point in time for the backtest.


TransactionLog
public List<Transaction> TransactionLog

Returns a list of the Transaction instances that represent all of the buy, sell, short, and cover trades that were placed


WinningPositions
public PositionList WinningPositions

Returns a PositionList instance containing Position instances for the positions with a net profit greater than or equal to zero.


YearlyReturns
public TimeSeries YearlyReturns

Returns a TimeSeries containing the yearly percentage returns of backtest equity curve.



Informational Properties
BacktestSettings
public BacktestSettings BacktestSettings

Returns the backtest settings (instance of the BacktestSettings class) used in the backtest.


PositionSize
public PositionSize PositionSize

Returns the positing sizing method (instance of the PositionSize class) used in the backtest.


StartingCapital
public double StartingCapital

Returns the starting capital that was used for the backtest.


Symbols
public List<BarHistory> Symbols

Returns a List containing the BarHistory instances for the symbols that were backtested.



Metrics
Metrics
public dynamic Metrics

The Metrics property returns an instance of the dynamic class that contains various performance metrics from the ScoreCards available in WL8. ScoreCards assign named property values to the Metrics propety for the performance metrics that they calculate. For example, the net profit of the backtest run is assigned to the Metrics.NetProfit property, and the APR to the Metrics.APR property. Performance Visualizers typically access these metrics values when depicting the backtest performance in an individual way.