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 |
using System; //using QuantConnect.Data.Market; //using System.Drawing; namespace Heiken.Ashi // just a name { public class Engine : QCAlgorithm // inherits from QCAlgo { private Security spy_d; private HeikinAshi spyHA_d; private decimal HA_O=2837m, HA_H=0m, HA_L=0m, HA_C=2837m; private Chart plotter = new Chart("HA_Plot"); public override void Initialize() // overrides mother method { SetStartDate(2019, 04, 01); //Set Start Date SetEndDate(2019, 05, 01); SetCash(10000); //Set Strategy Cash spy_d = AddCfd("SPX500USD", Resolution.Hour, Market.Oanda); var consolidator = new QuoteBarConsolidator(24); spyHA_d = new HeikinAshi(); RegisterIndicator("SPX500USD", spyHA_d, consolidator); SubscriptionManager.AddConsolidator("SPX500USD", consolidator); plotter.AddSeries(new Series("spy", SeriesType.Candle)); plotter.AddSeries(new Series("HA_O", SeriesType.Line)); plotter.AddSeries(new Series("HA_H", SeriesType.Line)); plotter.AddSeries(new Series("HA_L", SeriesType.Line)); plotter.AddSeries(new Series("HA_C", SeriesType.Line)); AddChart(plotter); } /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// Slice object keyed by symbol containing the stock data public void OnData(Slice data) { //HA_O = (HA_O + HA_C)/2; //HA_C = (spy_d.Open + spy_d.Close + spy_d.Low + spy_d.High)/4; if (!spyHA_d.IsReady) return; Log($"Indicator: {spyHA_d.Close}"); Plot("HA_Plot", "spy", spy_d.Close); Plot("HA_Plot", "HA_C", spyHA_d.Close); } } }