Overall Statistics |
Total Trades 202 Average Win 0.00% Average Loss -0.01% Compounding Annual Return -0.480% Drawdown 0.800% Expectancy -0.976 Net Profit -0.480% Sharpe Ratio -0.796 Loss Rate 98% Win Rate 2% Profit-Loss Ratio 0.12 Alpha -0.004 Beta 0.004 Annual Standard Deviation 0.005 Annual Variance 0 Information Ratio -0.052 Tracking Error 0.141 Treynor Ratio -1 Total Fees $0.00 |
namespace QuantConnect { public class BasicTemplateAlgorithm : QCAlgorithm { Equity _aapl; Symbol _sym; SimpleMovingAverage _sma; public override void Initialize() { // backtest parameters SetStartDate(2015, 1, 1); SetEndDate(2016, 1, 1); // cash allocation SetCash(100000); _aapl = AddEquity("AAPL", Resolution.Daily); _sym = _aapl.Symbol; _sma = SMA(_sym, 51, Resolution.Daily); Securities[_sym].FeeModel = new ConstantFeeTransactionModel(0.0m); } public override void OnData(Slice data) { if(!data.Bars.ContainsKey(_sym)) return; var bar = data.Bars[_sym]; if(_sma.IsReady) { if(bar.Close > _sma) { MarketOnOpenOrder(_sym, 1); MarketOnCloseOrder(_sym, -1); } else { MarketOnOpenOrder(_sym, -1); MarketOnCloseOrder(_sym, 1); } } } } }