GetFitnessArgs


Summary

Represents the custom fitness calculation interface.

Syntax

public interface GetFitnessArgs

Members

NameTypeSummary
AverageTrade PropertyGets the average profit for all trades.
Equity PropertyGets the equity of the account (balance plus unrealized profit and loss).
History PropertyGets all the historical trades.
LosingTrades PropertyGets total number of losing trades.
MaxBalanceDrawdown PropertyGets the maximum amount of balance drawdown in deposit currency.
MaxBalanceDrawdownPercentages PropertyGets the maximum amount of balance drawdown (%).
MaxEquityDrawdown PropertyGets the maximum amount of equity drawdown in deposit currency.
MaxEquityDrawdownPercentages PropertyGets the maximum amount of equity drawdown (%).
NetProfit PropertyGets the net profit of all trades.
PendingOrders PropertyGets all pending orders.
Positions PropertyGets all open positions.
ProfitFactor PropertyGets the Profit Factor - the ratio of Total Net Profit divided by the Total Net Loss.
SharpeRatio PropertyGets the ratio to measure risk-adjusted performance. The higher the value, the better.
SortinoRatio PropertyGets 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 PropertyGets the total number of trades taken.
WinningTrades PropertyGets 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;
        }
    }
}
Reference