Table of Contents

Class RiskAdjustedRatioParameter

Namespace
StockSharp.Algo.Statistics
Assembly
StockSharp.Algo.dll

Base class for risk-adjusted ratios (Sharpe/Sortino).

public abstract class RiskAdjustedRatioParameter : BasePnLStatisticParameter<decimal>, INotifyPropertyChangedEx, INotifyPropertyChanging, IStatisticParameter<decimal>, IPnLStatisticParameter, IStatisticParameter, IPersistable, INotifyPropertyChanged, IRiskFreeRateStatisticParameter
Inheritance
RiskAdjustedRatioParameter
Implements
Derived
Inherited Members
Extension Methods

Constructors

RiskAdjustedRatioParameter(StatisticParameterTypes)

Initializes a new instance of the RiskAdjustedRatioParameter class.

protected RiskAdjustedRatioParameter(StatisticParameterTypes type)

Parameters

type StatisticParameterTypes

Type

Properties

Period

Return calculation period.

public TimeSpan Period { get; set; }

Property Value

TimeSpan

RiskFreeRate

Annual risk-free rate (e.g., 0.03 = 3%).

public decimal RiskFreeRate { get; set; }

Property Value

decimal

Methods

Add(DateTimeOffset, decimal, decimal?)

To add new data to the parameter.

public override void Add(DateTimeOffset marketTime, decimal pnl, decimal? commission)

Parameters

marketTime DateTimeOffset

The exchange time.

pnl decimal

The profit-loss value.

commission decimal?

Commission.

AddRiskSample(decimal)

Adds a new sample to the risk accumulator.

protected abstract void AddRiskSample(decimal ret)

Parameters

ret decimal

The return value.

GetRisk(int, decimal)

Gets the risk value (e.g., stddev or downside deviation).

protected abstract decimal GetRisk(int count, decimal sumReturn)

Parameters

count int

Count of samples.

sumReturn decimal

Sum of all returns.

Returns

decimal

Risk value.

HasEnoughRiskSamples(int)

Checks if enough risk samples accumulated for calculation.

protected abstract bool HasEnoughRiskSamples(int count)

Parameters

count int

Count of samples.

Returns

bool

Check result.

Load(SettingsStorage)

To load the state of statistic parameter.

public override void Load(SettingsStorage storage)

Parameters

storage SettingsStorage

Storage.

Reset()

To reset the parameter value.

public override void Reset()

Save(SettingsStorage)

To save the state of statistic parameter.

public override void Save(SettingsStorage storage)

Parameters

storage SettingsStorage

Storage.