SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Feb 18, 2025 6:50 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Jul 21, 2015 9:45 am 
Offline

Joined: Thu Jun 04, 2015 2:10 pm
Posts: 25
Hi Support,

Along with Objective value, I want to log multiple statistics such as Sharpe Ratio, MaxDrawDawn etc. for each optimization. I tried to write a text file in append mode on OnStrategyStop() but because of multithreaded Optimization all the stats values were showing as 0 or NaN.

I also thought to override Objective function and return a concatenated string of statistics but this is also not possible as Objective function only returns double value.

Please help to show how i can collect multiple statistics for each optimization loop at one place.

Thanks


Top
 Profile  
 
PostPosted: Wed Jul 22, 2015 8:08 am 
Offline

Joined: Thu Jun 04, 2015 2:10 pm
Posts: 25
Someone know how to do this please?

Cheers


Top
 Profile  
 
PostPosted: Wed Jul 22, 2015 9:54 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 583
Can you please prepare simple strategy to reproduce this bug?
We cannot reproduce this in our examples.


Top
 Profile  
 
PostPosted: Wed Jul 22, 2015 9:58 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 583
Additionally, I output statistics onStrategyStop using this code:
Code:
        protected override void OnStrategyStop()
        {
            Portfolio portfolio = Portfolio;

            //show ParentStatistic
            if (false)
                portfolio = Portfolio.Parent;

            string timeFmt = "dd.MM.yyyy HH:mm:ss.fff";
            string message = "******************** " + Instrument + " Length1: " + Length1 + " Length2: " + Length2 + " Time: " + framework.Clock.DateTime.ToString(timeFmt) + "\r\n";

            var maxDrawdownStatistics = portfolio.Statistics.Items.GetByType(PortfolioStatisticsType.MaxDrawdown);
            int maxDrawdownCount = maxDrawdownStatistics.TotalValues.Count;
            double maxDrawdown = Math.Round(maxDrawdownStatistics.TotalValue, 2);
            message += "MaxDrawdown: " + maxDrawdown + " itemsCount: " + maxDrawdownCount + "\r\n";

            var sharpeRatioStatistics = portfolio.Statistics.Items.GetByType(PortfolioStatisticsType.SharpeRatio);
            int sharpeRatioCount = sharpeRatioStatistics.TotalValues.Count;
            double sharpeRatio = Math.Round(sharpeRatioStatistics.TotalValue, 2);
            message += "SharpeRatio: " + sharpeRatio + " itemsCount: " + sharpeRatioCount + "\r\n";

            double equity = Math.Round(portfolio.Value, 2);
            message += "Equity: " + equity + "\r\n";

            message.Trim();

            Console.WriteLine(message);
        }


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group