Overall Statistics
Total Trades
20
Average Win
17.71%
Average Loss
-5.05%
Compounding Annual Return
9.426%
Drawdown
43.600%
Expectancy
2.157
Net Profit
163.253%
Sharpe Ratio
0.546
Loss Rate
30%
Win Rate
70%
Profit-Loss Ratio
3.51
Alpha
0.088
Beta
-0.041
Annual Standard Deviation
0.158
Annual Variance
0.025
Information Ratio
0.12
Tracking Error
0.245
Treynor Ratio
-2.115
Total Fees
$165.80
namespace QuantConnect 
{   
    /*
    *   QuantConnect University: Full Basic Template:
    *
    *   The underlying QCAlgorithm class is full of helper methods which enable you to use QuantConnect.
    *   We have explained some of these here, but the full algorithm can be found at:
    *   https://github.com/QuantConnect/QCAlgorithm/blob/master/QuantConnect.Algorithm/QCAlgorithm.cs
    */
    public class SellinMay : QCAlgorithm
    {
    	//string symbol = "RTH";
    	string symbol = "XRT";
		int quantity = 0;
			
        public override void Initialize() 
        {
        	
            SetStartDate(2006, 1, 1);         
            SetEndDate(DateTime.Now.Date.AddDays(-1));
            SetCash(25000);
            AddSecurity(SecurityType.Equity, symbol, Resolution.Minute, true, 4, false);
        }

        //Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
        public void OnData(TradeBars data) 
        {   
        	if(Time.ToString("MMM") == "May"){
        		
        		if (Portfolio.HoldStock) 
	            {
	                Order(symbol, -Portfolio[symbol].Quantity);
					Debug("Sell in May: Flat " + Time.ToShortDateString() + " Quantity: -" + Portfolio[symbol].Quantity);
	                
	            }
        		
        	} else if (Time.ToString("MMM") == "Nov"){
        		
        		if (!Portfolio.HoldStock) 
	            {
	            	quantity = (int)(Portfolio.Cash / data[symbol].Close);
	                Order(symbol, quantity);
					Debug("Sell in May: Long " + Time.ToShortDateString() + " Quantity: -" + quantity);
	            }
        		
        	}
        	
        	
           
        }
    }
}