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 MyCustomChartingAlgorithm : QCAlgorithm { decimal lastOpenPrice = 0; decimal lastClosePrice = 0; ExponentialMovingAverage EMAFast; ExponentialMovingAverage EMASlow; DateTime startDate = new DateTime(2017, 1, 1); DateTime endDate = new DateTime(2017, 7, 18); public override void Initialize() { //Setting start and end date SetStartDate(startDate); SetEndDate(endDate); //Setting my cash SetCash(100000); //Adding my Assets AddForex("EURUSD", Resolution.Minute); //Consolidating my 15 minute bar var signalCheck = new QuoteBarConsolidator(TimeSpan.FromMinutes(15)); signalCheck.DataConsolidated += onsignalCheck; //Adding my indicators EMAFast = EMA("EURUSD", 9); EMASlow = EMA("EURUSD", 90); //Registering the indicators to work with the custom bar isntead of the standard resolution //RegisterIndicator("EURUSD", EMAFast, signalCheck); //RegisterIndicator("EURUSD", EMASlow, signalCheck); //Setting up my charts Chart stockPlot = new Chart("Trade Plot"); Series assetOpenPrice = new Series("Open", SeriesType.Scatter, 0); Series assetClosePrice = new Series("Close", SeriesType.Scatter, 0); Series fastMA = new Series("FastMA", SeriesType.Line, 0); Series slowMA = new Series("SlowMA", SeriesType.Line, 0); stockPlot.AddSeries(assetOpenPrice); stockPlot.AddSeries(assetClosePrice); stockPlot.AddSeries(fastMA); stockPlot.AddSeries(slowMA); AddChart(stockPlot); } public void onsignalCheck (object sender, QuoteBar bar) { if (!Portfolio.HoldStock) { SetHoldings("EURUSD", 10); } lastOpenPrice = bar.Open; lastClosePrice = bar.Close; Plot("Trade Plot", "Open", lastOpenPrice); Plot("Trade Plot", "Close", lastClosePrice); if (EMASlow.IsReady) { Plot("Trade Plot", "FastMA", EMAFast); Plot("Trade Plot", "SlowMA", EMASlow); } } public override void OnData(Slice data) { } } }