Overall Statistics |
Total Trades 470 Average Win 2.01% Average Loss -1.67% Compounding Annual Return 45.598% Drawdown 16.900% Expectancy 0.239 Net Profit 485.969% Sharpe Ratio 1.646 Loss Rate 44% Win Rate 56% Profit-Loss Ratio 1.20 Alpha 0.412 Beta -0.037 Annual Standard Deviation 0.245 Annual Variance 0.06 Information Ratio 0.45 Tracking Error 0.364 Treynor Ratio -10.972 Total Fees $2183.07 |
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 QCPoormans : QCAlgorithm, IAlgorithm { //Algorithm Variables private string symbol = "AAPL"; private decimal cash = 10000; //Initialize the Strategy public override void Initialize() { SetCash(cash); SetStartDate(2011, 01, 01); SetEndDate(DateTime.Now.AddDays(-1)); AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); // compute alpha/beta against AAPL SetBenchmark(symbol); } public override void OnEndOfDay(string symbol) { if(Time.Date.DayOfWeek == DayOfWeek.Friday && Portfolio[symbol].Quantity <= 0) { SetHoldings(symbol, 0.95M,true); } else if(Time.Date.DayOfWeek == DayOfWeek.Wednesday && Portfolio[symbol].Quantity >= 0) { SetHoldings(symbol, -0.95M, true); } Plot(symbol, Securities[symbol].Price ); } } }