SmartQuant Discussion
http://www.smartquant.com/forums/

Statistics
http://www.smartquant.com/forums/viewtopic.php?f=86&t=11013
Page 1 of 1

Author:  rickkeller [ Tue Oct 20, 2015 5:00 pm ]
Post subject:  Statistics

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.

Author:  skuvv [ Fri Oct 23, 2015 1:57 pm ]
Post subject:  Re: Statistics

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 );
      }

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/