NinjaScript > Language Reference > Strategy > TradeCollection >

TradesPerformance

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Performance profile of a collection of Trade objects.

 

Methods and Properties

AvgBarsInTrade

A double value representing the avg number of bars per trade

AvgTradeDuration

A TimeSpan value representing quantity-weighted avg duration of a trade

Commission

A double value representing the total commission

Currency

Gets a TradesPerformanceValues object in currency

GetSharpeRatio()

Calculates the Sharpe ratio using a defined risk free return

GrossLoss

A double value representing the gross loss

GrossProfit

A double value representing the gross profit

MaxConsecLoser

An int value representing the maximum number of consecutive losses seen

MaxConsecWinner

An int value representing the maximum number of consecutive winners seen

MaxTime2Recover

A TimeSpan value representing maximum time to recover from a draw down

Percent

Gets a TradesPerformanceValues object in percent

Points

Gets a TradesPerformanceValues object in points

ProfitFactor

A double value representing the profit factor

SharpeRatio

A double value representing Sharpe ratio using a zero risk free return

TradesPerDay

An int value representing the avg trades per day

 

 

Examples

protected override void OnBarUpdate()
{
    // Only trade if you have less than 5 consecutive losers in a row
    if (Performance.RealtimeTrades.TradesPerformance.MaxConsecLoser < 5)
    {
        // Trade logic here
    }
}