Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
//Universe Selection and Indicator - tester using System; using System.Collections.Generic; using System.Linq; using QuantConnect.Data; using QuantConnect.Data.Consolidators; using QuantConnect.Data.Market; using QuantConnect.Indicators; namespace QuantConnect { /* * The underlying QCAlgorithm class has many methods which enable you to use QuantConnect. * We have explained some of these here, but the full base class can be found at: * https://github.com/QuantConnect/Lean/tree/master/Algorithm */ public class UniverseSelectionandIndicatorAlgorithm : QCAlgorithm { private SecurityChanges _changes = SecurityChanges.None; public SimpleMovingAverage smaStopPrice; public override void Initialize() { SetStartDate(2018, 01, 1); SetEndDate(2018, 05, 29); SetCash(25000); UniverseSettings.Leverage = 1.0m; UniverseSettings.Resolution = Resolution.Daily; AddUniverse(Universe.DollarVolume.Top(3)); SetWarmup(20,Resolution.Daily); } public void OnData(TradeBars data) // New data arrives here. { if (IsWarmingUp) return; foreach (var universe in UniverseManager.Values) { if (universe is UserDefinedUniverse) {continue;} if (_changes == SecurityChanges.None) { Debug ("No Changes"); return; } foreach (var security in _changes.AddedSecurities) { smaStopPrice = SMA(security.Symbol,15,Resolution.Daily); decimal stopprice = smaStopPrice; Debug (String.Format("Pick:{0} - OHLC[{1:0.00}, {2:0.00}, {3:0.00}, {4:0.00}, {5:0} {6:0.00}] ", security.Symbol, data[security.Symbol].Open,data[security.Symbol].High,data[security.Symbol].Low, data[security.Symbol].Close,data[security.Symbol].Volume, stopprice)); } } } public override void OnSecuritiesChanged(SecurityChanges changes) { _changes = changes; Debug("===Start of Trading ===: " + Time.ToShortDateString() + " Symbols: " + _changes.AddedSecurities.Count + "|" + _changes.RemovedSecurities.Count) ; if (changes.AddedSecurities.Count > 0) Debug("Securities added: " + string.Join(",", changes.AddedSecurities.Select(x => x.Symbol.Value))); if (changes.RemovedSecurities.Count > 0) Debug("Securities removed: " + string.Join(",", changes.RemovedSecurities.Select(x => x.Symbol.Value))); } } //BasicTemplateAlgorithm } //namespace