Overall Statistics
Total Trades
12
Average Win
8.64%
Average Loss
-5.75%
Compounding Annual Return
6.606%
Drawdown
26.500%
Expectancy
0.669
Net Profit
317.963%
Sharpe Ratio
0.492
Probabilistic Sharpe Ratio
0.317%
Loss Rate
33%
Win Rate
67%
Profit-Loss Ratio
1.50
Alpha
0.061
Beta
0.029
Annual Standard Deviation
0.128
Annual Variance
0.016
Information Ratio
-0.048
Tracking Error
0.215
Treynor Ratio
2.168
Total Fees
$86.87
using System;
using System.Collections;
using System.Collections.Generic; 

namespace QuantConnect 
{
    using QuantConnect.Securities;
    using QuantConnect.Models; 

    //Sell in May Algorithm Example:
    public partial class QCUSellInMay : QCAlgorithm, IAlgorithm { 

        private string symbol = "SPY";
        private string symbol2 = "TLT";
        private decimal cash = 100000;
        
        //Initialize the Strategy
        public override void Initialize() {
            SetCash(cash);
            SetStartDate(1998, 01, 01);
            AddSecurity(SecurityType.Equity, symbol, Resolution.Daily);
            AddSecurity(SecurityType.Equity, symbol2, Resolution.Daily);
        }
        
        //Handle the data events:
        public void OnData(TradeBars data) {
            if (Time.ToString("MMM") == "May") {
                if (Portfolio.HoldStock) {
                    SetHoldings(symbol, 0);
                    SetHoldings(symbol2, 1);
                    Debug("QCU Sell In May: Flat " + Time.ToString("Y"));
                }
            } else {
                if (!Portfolio.HoldStock && Time.ToString("MMM") == "Nov") {
                    SetHoldings(symbol, 1);
                    SetHoldings(symbol2, 0);
                    Debug("QCU Sell In May: Long " + Time.ToString("Y"));
                }
            }      
        }
    }
}