Skip to content

GetFitnessArgs

Summary

Represents the custom fitness calculation interface.

Signature

1
public abstract interface GetFitnessArgs

Namespace

cAlgo.API

Properties

Name Description
History { get; } Gets all the historical trades.
Positions { get; } Gets all open positions.
PendingOrders { get; } Gets all pending orders.
Equity { get; } Gets the equity of the account (balance plus unrealized profit and loss).
NetProfit { get; } Gets the net profit of all trades in account deposit currency.
MaxBalanceDrawdownPercentages { get; } Gets the maximum amount of balance drawdown in percentage (ex: 40%).It can return a positive value between 0-100.
MaxEquityDrawdownPercentages { get; } Gets the maximum amount of equity drawdown in percentage (ex: 40%).It can return a positive value between 0-100.
MaxBalanceDrawdown { get; } Gets the maximum amount of balance drawdown in account deposit currency.
MaxEquityDrawdown { get; } Gets the maximum amount of equity drawdown in account deposit currency.
WinningTrades { get; } Gets the total number of winning trades.
LosingTrades { get; } Gets total number of losing trades.
TotalTrades { get; } Gets the total number of trades taken.
AverageTrade { get; } Gets the average profit for all trades in account deposit currency.
ProfitFactor { get; } Gets the Profit Factor - the ratio of Total Net Profit divided by the Total Net Loss.
SharpeRatio { get; } Gets the ratio to measure risk-adjusted performance. The higher the value, the better.
SortinoRatio { get; } 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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
 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;
         }
     }
 }

Last update: December 5, 2022

Comments