Summary
Represents the custom fitness calculation interface.
Syntax
public interface GetFitnessArgs
Members
Name | Type | Summary |
---|---|---|
AverageTrade | Property | Gets the average profit for all trades. |
Equity | Property | Gets the equity of the account (balance plus unrealized profit and loss). |
History | Property | Gets all the historical trades. |
LosingTrades | Property | Gets total number of losing trades. |
MaxBalanceDrawdown | Property | Gets the maximum amount of balance drawdown in deposit currency. |
MaxBalanceDrawdownPercentages | Property | Gets the maximum amount of balance drawdown (%). |
MaxEquityDrawdown | Property | Gets the maximum amount of equity drawdown in deposit currency. |
MaxEquityDrawdownPercentages | Property | Gets the maximum amount of equity drawdown (%). |
NetProfit | Property | Gets the net profit of all trades. |
PendingOrders | Property | Gets all pending orders. |
Positions | Property | Gets all open positions. |
ProfitFactor | Property | Gets the Profit Factor - the ratio of Total Net Profit divided by the Total Net Loss. |
SharpeRatio | Property | Gets the ratio to measure risk-adjusted performance. The higher the value, the better. |
SortinoRatio | Property | Gets the Sortino ratio is an alternative to the Sharpe ratio, using downward deviation in place of standard deviation. The higher the value, the better. |
TotalTrades | Property | Gets the total number of trades taken. |
WinningTrades | Property | Gets the total number of winning trades. |
Example 1
using cAlgo.API; namespace cAlgo.Robots { // This sample shows how to use the GetFitnessArgs to change the default fitness metric of optimizer [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class GetFitnessArgsSample : Robot { protected override void OnStart() { } protected override double GetFitness(GetFitnessArgs args) { // Here we are using the win rate as fitness // You can use any other value by combining the values of GetFitnessArgs object properties return args.WinningTrades / args.TotalTrades; } } }