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 |
namespace QuantConnect.Algorithm.CSharp { public class PastClose : QCAlgorithm { public string testsymbol1 = "SLB"; public string testsymbol2 = "IBM"; public int barsize = 4; private RollingWindow<TradeBar> bar; public override void Initialize() { SetStartDate(2018, 04, 10); //Set Start Date SetEndDate(2018, 04, 18); //Set End Date SetCash(100000); //Set Strategy Cash AddSecurity(SecurityType.Equity, testsymbol1, Resolution.Daily); //AddSecurity(SecurityType.Equity, testsymbol2, Resolution.Daily); Securities[testsymbol1].SetDataNormalizationMode(DataNormalizationMode.Raw); //Securities[testsymbol2].SetDataNormalizationMode(DataNormalizationMode.Raw); bar = new RollingWindow<TradeBar>(barsize); } public void OnData(TradeBars data) { foreach(var security in Securities.Values) { bar.Add(data[security.Symbol]); if (!bar.IsReady) return; Debug("-----------------------"); for (int i1 = 0; i1 < barsize; i1++) //Get past x days of history { Debug (String.Format("B:{0} {1} - OHLCV[{2:0.00}, {3:0.00}, {4:0.00}, {5:0.00}, {6:0}", bar[i1].Time, security.Symbol, bar[i1].Open,bar[i1].High, bar[i1].Low, bar[i1].Close, bar[i1].Volume)); } } } } }