Lean
$LEAN_TAG$
|
The TradeStatistics class represents a set of statistics calculated from a list of closed trades More...
Public Member Functions | |
TradeStatistics (IEnumerable< Trade > trades) | |
Initializes a new instance of the TradeStatistics class More... | |
TradeStatistics () | |
Initializes a new instance of the TradeStatistics class More... | |
Properties | |
DateTime? | StartDateTime [get, set] |
The entry date/time of the first trade More... | |
DateTime? | EndDateTime [get, set] |
The exit date/time of the last trade More... | |
int | TotalNumberOfTrades [get, set] |
The total number of trades More... | |
int | NumberOfWinningTrades [get, set] |
The total number of winning trades More... | |
int | NumberOfLosingTrades [get, set] |
The total number of losing trades More... | |
decimal | TotalProfitLoss [get, set] |
The total profit/loss for all trades (as symbol currency) More... | |
decimal | TotalProfit [get, set] |
The total profit for all winning trades (as symbol currency) More... | |
decimal | TotalLoss [get, set] |
The total loss for all losing trades (as symbol currency) More... | |
decimal | LargestProfit [get, set] |
The largest profit in a single trade (as symbol currency) More... | |
decimal | LargestLoss [get, set] |
The largest loss in a single trade (as symbol currency) More... | |
decimal | AverageProfitLoss [get, set] |
The average profit/loss (a.k.a. Expectancy or Average Trade) for all trades (as symbol currency) More... | |
decimal | AverageProfit [get, set] |
The average profit for all winning trades (as symbol currency) More... | |
decimal | AverageLoss [get, set] |
The average loss for all winning trades (as symbol currency) More... | |
TimeSpan | AverageTradeDuration [get, set] |
The average duration for all trades More... | |
TimeSpan | AverageWinningTradeDuration [get, set] |
The average duration for all winning trades More... | |
TimeSpan | AverageLosingTradeDuration [get, set] |
The average duration for all losing trades More... | |
TimeSpan | MedianTradeDuration [get, set] |
The median duration for all trades More... | |
TimeSpan | MedianWinningTradeDuration [get, set] |
The median duration for all winning trades More... | |
TimeSpan | MedianLosingTradeDuration [get, set] |
The median duration for all losing trades More... | |
int | MaxConsecutiveWinningTrades [get, set] |
The maximum number of consecutive winning trades More... | |
int | MaxConsecutiveLosingTrades [get, set] |
The maximum number of consecutive losing trades More... | |
decimal | ProfitLossRatio [get, set] |
The ratio of the average profit per trade to the average loss per trade More... | |
decimal | WinLossRatio [get, set] |
The ratio of the number of winning trades to the number of losing trades More... | |
decimal | WinRate [get, set] |
The ratio of the number of winning trades to the total number of trades More... | |
decimal | LossRate [get, set] |
The ratio of the number of losing trades to the total number of trades More... | |
decimal | AverageMAE [get, set] |
The average Maximum Adverse Excursion for all trades More... | |
decimal | AverageMFE [get, set] |
The average Maximum Favorable Excursion for all trades More... | |
decimal | LargestMAE [get, set] |
The largest Maximum Adverse Excursion in a single trade (as symbol currency) More... | |
decimal | LargestMFE [get, set] |
The largest Maximum Favorable Excursion in a single trade (as symbol currency) More... | |
decimal | MaximumClosedTradeDrawdown [get, set] |
The maximum closed-trade drawdown for all trades (as symbol currency) More... | |
decimal | MaximumIntraTradeDrawdown [get, set] |
The maximum intra-trade drawdown for all trades (as symbol currency) More... | |
decimal | ProfitLossStandardDeviation [get, set] |
The standard deviation of the profits/losses for all trades (as symbol currency) More... | |
decimal | ProfitLossDownsideDeviation [get, set] |
The downside deviation of the profits/losses for all trades (as symbol currency) More... | |
decimal | ProfitFactor [get, set] |
The ratio of the total profit to the total loss More... | |
decimal | SharpeRatio [get, set] |
The ratio of the average profit/loss to the standard deviation More... | |
decimal | SortinoRatio [get, set] |
The ratio of the average profit/loss to the downside deviation More... | |
decimal | ProfitToMaxDrawdownRatio [get, set] |
The ratio of the total profit/loss to the maximum closed trade drawdown More... | |
decimal | MaximumEndTradeDrawdown [get, set] |
The maximum amount of profit given back by a single trade before exit (as symbol currency) More... | |
decimal | AverageEndTradeDrawdown [get, set] |
The average amount of profit given back by all trades before exit (as symbol currency) More... | |
TimeSpan | MaximumDrawdownDuration [get, set] |
The maximum amount of time to recover from a drawdown (longest time between new equity highs or peaks) More... | |
decimal | TotalFees [get, set] |
The sum of fees for all trades More... | |
The TradeStatistics class represents a set of statistics calculated from a list of closed trades
Definition at line 26 of file TradeStatistics.cs.
QuantConnect.Statistics.TradeStatistics.TradeStatistics | ( | IEnumerable< Trade > | trades | ) |
Initializes a new instance of the TradeStatistics class
trades | The list of closed trades |
Definition at line 276 of file TradeStatistics.cs.
QuantConnect.Statistics.TradeStatistics.TradeStatistics | ( | ) |
Initializes a new instance of the TradeStatistics class
Definition at line 438 of file TradeStatistics.cs.
|
getset |
The entry date/time of the first trade
Definition at line 31 of file TradeStatistics.cs.
|
getset |
The exit date/time of the last trade
Definition at line 36 of file TradeStatistics.cs.
|
getset |
The total number of trades
Definition at line 41 of file TradeStatistics.cs.
|
getset |
The total number of winning trades
Definition at line 46 of file TradeStatistics.cs.
|
getset |
The total number of losing trades
Definition at line 51 of file TradeStatistics.cs.
|
getset |
The total profit/loss for all trades (as symbol currency)
Definition at line 57 of file TradeStatistics.cs.
|
getset |
The total profit for all winning trades (as symbol currency)
Definition at line 63 of file TradeStatistics.cs.
|
getset |
The total loss for all losing trades (as symbol currency)
Definition at line 69 of file TradeStatistics.cs.
|
getset |
The largest profit in a single trade (as symbol currency)
Definition at line 75 of file TradeStatistics.cs.
|
getset |
The largest loss in a single trade (as symbol currency)
Definition at line 81 of file TradeStatistics.cs.
|
getset |
The average profit/loss (a.k.a. Expectancy or Average Trade) for all trades (as symbol currency)
Definition at line 87 of file TradeStatistics.cs.
|
getset |
The average profit for all winning trades (as symbol currency)
Definition at line 93 of file TradeStatistics.cs.
|
getset |
The average loss for all winning trades (as symbol currency)
Definition at line 99 of file TradeStatistics.cs.
|
getset |
The average duration for all trades
Definition at line 104 of file TradeStatistics.cs.
|
getset |
The average duration for all winning trades
Definition at line 109 of file TradeStatistics.cs.
|
getset |
The average duration for all losing trades
Definition at line 114 of file TradeStatistics.cs.
|
getset |
The median duration for all trades
Definition at line 119 of file TradeStatistics.cs.
|
getset |
The median duration for all winning trades
Definition at line 124 of file TradeStatistics.cs.
|
getset |
The median duration for all losing trades
Definition at line 129 of file TradeStatistics.cs.
|
getset |
The maximum number of consecutive winning trades
Definition at line 134 of file TradeStatistics.cs.
|
getset |
The maximum number of consecutive losing trades
Definition at line 139 of file TradeStatistics.cs.
|
getset |
The ratio of the average profit per trade to the average loss per trade
If the average loss is zero, ProfitLossRatio is set to 0
Definition at line 146 of file TradeStatistics.cs.
|
getset |
The ratio of the number of winning trades to the number of losing trades
If the total number of trades is zero, WinLossRatio is set to zero
If the number of losing trades is zero and the number of winning trades is nonzero, WinLossRatio is set to 10
Definition at line 154 of file TradeStatistics.cs.
|
getset |
The ratio of the number of winning trades to the total number of trades
If the total number of trades is zero, WinRate is set to zero
Definition at line 161 of file TradeStatistics.cs.
|
getset |
The ratio of the number of losing trades to the total number of trades
If the total number of trades is zero, LossRate is set to zero
Definition at line 168 of file TradeStatistics.cs.
|
getset |
The average Maximum Adverse Excursion for all trades
Definition at line 174 of file TradeStatistics.cs.
|
getset |
The average Maximum Favorable Excursion for all trades
Definition at line 180 of file TradeStatistics.cs.
|
getset |
The largest Maximum Adverse Excursion in a single trade (as symbol currency)
Definition at line 186 of file TradeStatistics.cs.
|
getset |
The largest Maximum Favorable Excursion in a single trade (as symbol currency)
Definition at line 192 of file TradeStatistics.cs.
|
getset |
The maximum closed-trade drawdown for all trades (as symbol currency)
The calculation only takes into account the profit/loss of each trade
Definition at line 199 of file TradeStatistics.cs.
|
getset |
The maximum intra-trade drawdown for all trades (as symbol currency)
The calculation takes into account MAE and MFE of each trade
Definition at line 206 of file TradeStatistics.cs.
|
getset |
The standard deviation of the profits/losses for all trades (as symbol currency)
Definition at line 212 of file TradeStatistics.cs.
|
getset |
The downside deviation of the profits/losses for all trades (as symbol currency)
This metric only considers deviations of losing trades
Definition at line 219 of file TradeStatistics.cs.
|
getset |
The ratio of the total profit to the total loss
If the total profit is zero, ProfitFactor is set to zero
if the total loss is zero and the total profit is nonzero, ProfitFactor is set to 10
Definition at line 227 of file TradeStatistics.cs.
|
getset |
The ratio of the average profit/loss to the standard deviation
Definition at line 233 of file TradeStatistics.cs.
|
getset |
The ratio of the average profit/loss to the downside deviation
Definition at line 239 of file TradeStatistics.cs.
|
getset |
The ratio of the total profit/loss to the maximum closed trade drawdown
If the total profit/loss is zero, ProfitToMaxDrawdownRatio is set to zero
if the drawdown is zero and the total profit is nonzero, ProfitToMaxDrawdownRatio is set to 10
Definition at line 247 of file TradeStatistics.cs.
|
getset |
The maximum amount of profit given back by a single trade before exit (as symbol currency)
Definition at line 253 of file TradeStatistics.cs.
|
getset |
The average amount of profit given back by all trades before exit (as symbol currency)
Definition at line 259 of file TradeStatistics.cs.
|
getset |
The maximum amount of time to recover from a drawdown (longest time between new equity highs or peaks)
Definition at line 264 of file TradeStatistics.cs.
|
getset |
The sum of fees for all trades
Definition at line 270 of file TradeStatistics.cs.