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 { public class PivotPoints{ private decimal high; private decimal low; private decimal close; private decimal open; public PivotPoints(decimal h, decimal l, decimal c, decimal o){ high = h; low = l; close = c; open = o; } public decimal getR3(){ return (high + (2*(((high+low+close)/3) - low))); } public decimal getR2(){ return (((high+low+close)/3)+(high-low)); } public decimal getR1(){ return ((((high+low+close)/3)*2)-low); } public decimal getPP(){ return (high+low+close)/3; } public decimal getS1(){ return ((((high+low+close)/3)*2)-high); } public decimal getS2(){ return (((high+low+close)/3)-(high-low));; } public decimal getS3(){ return (low - (2*(high - ((high+low+close)/3)))); } } }
namespace QuantConnect.Algorithm.CSharp{ public class BasicTemplateAlgorithm : QCAlgorithm{ String symbol = "SPY"; RollingWindow<Decimal> high = new RollingWindow<Decimal>(10); RollingWindow<Decimal> low = new RollingWindow<Decimal>(10); RollingWindow<Decimal> open = new RollingWindow<Decimal>(10); RollingWindow<Decimal> close = new RollingWindow<Decimal>(10); SimpleMovingAverage sma; decimal p = 0; public override void Initialize(){ SetStartDate(2018, 02, 01); SetEndDate(DateTime.Now.Date.AddDays(-1)); SetCash(100000); AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); sma = SMA(symbol, 200, Resolution.Daily); TradeBarConsolidator consolidator = new TradeBarConsolidator(TimeSpan.FromDays(1)); consolidator.DataConsolidated += ConsolidatorHandler; SubscriptionManager.AddConsolidator(symbol, consolidator); } public void ConsolidatorHandler(object sender, TradeBar data) { high.Add(data.High); low.Add(data.Low); open.Add(data.Open); close.Add(data.Close); if(!high.IsReady) return; PivotPoints pp = new PivotPoints(high[1], low[1], close[1], open[1]); p = pp.getPP(); Debug("High: "+high[0].ToString()); Debug("Low: "+low[0].ToString()); Debug("Close: "+close[0].ToString()); Debug("Open: "+open[0].ToString()); Debug("-----------------------------------"); } public override void OnData(Slice data){ if (data[symbol] == null) return; if (p == 0) return; } } }