SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Fri Dec 03, 2021 11:04 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Statistics
PostPosted: Tue Oct 20, 2015 5:00 pm 
Offline

Joined: Wed Mar 05, 2008 5:03 pm
Posts: 6
Do you have a formula reference for how you calculate statistics? I don't want to re-invent the wheel, but not sure if you are calculating statistics the same way I do and whether they are working as expected.

For instance, MaxFavorableExcursion and MaxAdverseExcursion are equal to commission in your statistics, and I don't think that is correct.


Top
 Profile  
 
 Post subject: Re: Statistics
PostPosted: Fri Oct 23, 2015 1:57 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 583
I made simple test and results looks properly(MaxFavorableExcursion and MaxAdverseExcursion not equals to commissions):
Code:
20.12.2013 20:00:00 AAPL
NumOfTrades: 23
MaxAdverseExcursion: -100.000000000005
MaxFavorableExcursion: -4.00000000000182
NumOfTransactions: 46
CommissionProvider.Type: PerShare
CommissionProvider.Commission: 0.03
CommissionProvider.MinCommission: 0
TotalCommissions: 138
SharesTraded: 4600
**************************
20.12.2013 20:00:00 AAPL
NumOfTrades: 23
MaxAdverseExcursion: -96.3000000000055
MaxFavorableExcursion: -0.300000000001819
NumOfTransactions: 46
CommissionProvider.Type: Absolute
CommissionProvider.Commission: 1.15
CommissionProvider.MinCommission: 0
TotalCommissions: 52.9
SharesTraded: 4600


Code added to output:
Code:
      protected override void OnStrategyStop()
      {
         Console.WriteLine(framework.Clock.DateTime+" "+Instrument.Symbol);
         
         Console.WriteLine("NumOfTrades: "+Portfolio.Statistics.Get(PortfolioStatisticsType.NumOfTrades).TotalValue );
         Console.WriteLine("MaxAdverseExcursion: "+Portfolio.Statistics.Get(PortfolioStatisticsType.MaxAdverseExcursion).TotalValue );
         Console.WriteLine("MaxFavorableExcursion: "+Portfolio.Statistics.Get(PortfolioStatisticsType.MaxFavorableExcursion).TotalValue );
         Console.WriteLine("NumOfTransactions: "+Portfolio.Transactions.Count );
         Console.WriteLine("CommissionProvider.Type: "+ExecutionSimulator.CommissionProvider.Type);
         Console.WriteLine("CommissionProvider.Commission: "+ExecutionSimulator.CommissionProvider.Commission);
         Console.WriteLine("CommissionProvider.MinCommission: "+ExecutionSimulator.CommissionProvider.MinCommission);
         
         double commissions = 0;
         double sharesTraded = 0;
         foreach(Transaction transaction in Portfolio.Transactions)
         {
            commissions += transaction.Commission;
            sharesTraded += transaction.Qty;
         }
         
         Console.WriteLine("TotalCommissions: " + commissions );
         Console.WriteLine("SharesTraded: " + sharesTraded );
      }


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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