Sharpe Sortino Ratio Missing

Created at 31 May 2024, 11:49
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CO

corakteknikal

Joined 31.05.2024

Sharpe Sortino Ratio Missing
31 May 2024, 11:49


I could no longer see Sharpe Sortino Ratio on ios mobile app.

Removed permanently?


@corakteknikal
Replies

PanagiotisCharalampous
31 May 2024, 12:00

Hi there, 

Yes it has been removed permanently.

Best regards,

Panagiotis


@PanagiotisCharalampous

robert.john.edgar
16 Nov 2024, 17:32

RE: Sharpe Sortino Ratio Missing

PanagiotisCharalampous said: 

Hi there, 

Yes it has been removed permanently.

Best regards,

Panagiotis

Seems my local only just upgraded and removed sortino/sharpe.

Why did it get removed?

Is there any workaround for this or some plugin or other way we can get this?

My past experience with cTrader optimization is you get pretty poor results if you can't see either sharpe or sortino.


@robert.john.edgar

PanagiotisCharalampous
17 Nov 2024, 08:45

RE: RE: Sharpe Sortino Ratio Missing

robert.john.edgar said: 

PanagiotisCharalampous said: 

Hi there, 

Yes it has been removed permanently.

Best regards,

Panagiotis

Seems my local only just upgraded and removed sortino/sharpe.

Why did it get removed?

Is there any workaround for this or some plugin or other way we can get this?

My past experience with cTrader optimization is you get pretty poor results if you can't see either sharpe or sortino.

Hi there,

The previous calculation was not correct and the information required to properly calculate these metrics (risk free ratio) is not available in cTrader.

Best regards,

Panagiotis


@PanagiotisCharalampous

robert.john.edgar
18 Nov 2024, 20:01

RE: RE: RE: Sharpe Sortino Ratio Missing

PanagiotisCharalampous said: 

robert.john.edgar said: 

PanagiotisCharalampous said: 

Hi there, 

Yes it has been removed permanently.

Best regards,

Panagiotis

Seems my local only just upgraded and removed sortino/sharpe.

Why did it get removed?

Is there any workaround for this or some plugin or other way we can get this?

My past experience with cTrader optimization is you get pretty poor results if you can't see either sharpe or sortino.

Hi there,

The previous calculation was not correct and the information required to properly calculate these metrics (risk free ratio) is not available in cTrader.

Best regards,

Panagiotis

I would have thought even if acknowledging it was technically wrong they would still maintain the old version as  “use at your own discretion” rather than just killing it dead….  

It was clear it wasn't producing the expected value but the thing was the value it did calculate was actually really useful at least for a bot on a single asset and a single time period and proved to work in practice.

Sadly without it the optimization maybe not totally useless but is well on the way to being so.


@robert.john.edgar

robert.john.edgar
22 Nov 2024, 13:36

RE: RE: RE: RE: Sharpe Sortino Ratio Missing

robert.john.edgar said: 

PanagiotisCharalampous said: 

robert.john.edgar said: 

PanagiotisCharalampous said: 

Hi there, 

Yes it has been removed permanently.

Best regards,

Panagiotis

Seems my local only just upgraded and removed sortino/sharpe.

Why did it get removed?

Is there any workaround for this or some plugin or other way we can get this?

My past experience with cTrader optimization is you get pretty poor results if you can't see either sharpe or sortino.

Hi there,

The previous calculation was not correct and the information required to properly calculate these metrics (risk free ratio) is not available in cTrader.

Best regards,

Panagiotis

I would have thought even if acknowledging it was technically wrong they would still maintain the old version as  “use at your own discretion” rather than just killing it dead….  

It was clear it wasn't producing the expected value but the thing was the value it did calculate was actually really useful at least for a bot on a single asset and a single time period and proved to work in practice.

Sadly without it the optimization maybe not totally useless but is well on the way to being so.

For anyone who might be interested in this topic:
I found this code snippet to calculate the Sortino and Sharpe ratios from an old post.
 

 	public static double SharpeSortino(bool isSortino, IEnumerable<double> vals)
    {
         if (vals.Count() < 2) return double.NaN;
         double average = vals.Average();
         double sd = Math.Sqrt(vals.Where(val => (!isSortino || val < average)).Select(val => (val - average) * (val - average)).Sum() / (vals.Count() - 1));
         return average / sd;
    }

And so can you call it:

    var SharpeRatio = SharpeSortino(false, History.Select(trade => trade.NetProfit));
    var SortinoRatio = SharpeSortino(true, History.Select(trade => trade.NetProfit));

This will give you the exact same results as Spotware was calculating it.

 

So cTrader gives us the option to add a custom function into the Optimization Criteria to replace the built in values.
To do this we need to add a GetFitness method to the Bot.

Now we can calculate the old Sortino Ratio we could include it in a custom GetFitness function, for example like this:

        protected override double GetFitness(GetFitnessArgs args)
        {
            // Retrieve values from args
            double netProfit = args.NetProfit; // Total net profit
            double maxDrawdownPercentage = args.MaxEquityDrawdownPercentages; // Maximum drawdown %
            int totalTrades = args.History.Count; // Total number of trades
            double profitFactor = args.ProfitFactor;
            
            // Ensure minimums are met
            if (totalTrades <= 1 || profitFactor < 1.5 || maxDrawdownPercentage > 20 || netProfit < 0) return double.NegativeInfinity;

            // Calculate Sortino Ratio
            double sortinoRatio = SharpeSortino(true, args.History.Select(trade => trade.NetProfit));
            // Multi-Criteria Fitness Function
            double fitness =
                (netProfit * .2) +  // Maximize net profit (20% weight)
                (profitFactor * .2) +  // Maximize profit factor(20% weight)
                (-maxDrawdownPercentage * .2) +  // Minimize drawdown (20% weight, negative because lower is better)
                (totalTrades * .1) +  // Maximize total trades (10% weight)
                (sortinoRatio * .3);  // Maximize Sortino Ratio (30% weight)

            return fitness;
        }

 

From what I had read somewhere I think cTrader just gives each criteria the same weight, but you might want to vary that as above.

Unfortunately there is no way to display the actual Sortino and Sharpe values in the Optimization grid which is unfortunate as personally I used to scan the results.

As ever use at your own risk and always test first….

 

 

 


 


@robert.john.edgar