Overall Statistics |
Total Trades 57 Average Win 8.40% Average Loss -3.57% Compounding Annual Return 10.860% Drawdown 35.000% Expectancy 0.678 Net Profit 67.540% Sharpe Ratio 0.638 Loss Rate 50% Win Rate 50% Profit-Loss Ratio 2.36 Alpha 0.094 Beta 0.024 Annual Standard Deviation 0.15 Annual Variance 0.023 Information Ratio 0 Tracking Error 0.185 Treynor Ratio 4.058 Total Fees $127.80 |
//Copyright Warren Harding 2016, granted to the public domain. //Use entirely at your own risk. //Custom algorithm development: warrencharding@yahoo.com. //Do not remove this copyright notice. namespace QuantConnect { public class TQQQSQQQ : QCAlgorithm { StandardDeviation std; int indicatorPeriod=390; Resolution resolution=Resolution.Minute; public override void Initialize() { // backtest parameters SetStartDate(2012, 8, 11); SetEndDate(2017, 8, 11); // cash allocation SetCash(25000); AddEquity("QQQ", resolution); AddEquity("PSQ", resolution); std = STD("QQQ", indicatorPeriod, resolution); var history = History("QQQ", indicatorPeriod, resolution); foreach (var tradeBar in history) { std.Update(tradeBar.EndTime, tradeBar.Close); } } public override void OnData(Slice data) { if (std<1.2m) { SetHoldings("PSQ", 0); SetHoldings("QQQ", 1.0); } else { SetHoldings("QQQ", 0); SetHoldings("PSQ", 1.0); } } } }