| 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 CustomChartingAlgorithm : QCAlgorithm
{
decimal lastOpenPrice = 0;
decimal lastClosePrice = 0;
ExponentialMovingAverage EMAFast;
ExponentialMovingAverage EMASlow;
DateTime startDate = new DateTime(2017, 7, 19);
DateTime endDate = new DateTime(2017, 7, 20);
public override void Initialize()
{
SetStartDate(startDate);
SetEndDate(endDate);
SetCash(100000);
AddForex("EURUSD", Resolution.Minute);
Chart stockPlot = new Chart("Hello"); //He is shy.
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);
EMAFast = EMA("EURUSD", 9);
EMASlow = EMA("EURUSD", 90);
stockPlot.AddSeries(assetOpenPrice);
stockPlot.AddSeries(assetClosePrice);
stockPlot.AddSeries(fastMA);
stockPlot.AddSeries(slowMA);
AddChart(stockPlot); //I invited him, he didn't answer and didn't show up either.
}
public void OnData(QuoteBars data)
{
lastOpenPrice = data["EURUSD"].Open;
lastClosePrice = data["EURUSD"].Close;
PlotAll();
}
public override void OnEndOfDay()
{
//PlotAll();
}
private void PlotAll()
{
Plot("Hello", "Open", lastOpenPrice);
Plot("Hello", "Close", lastClosePrice);
if (EMASlow.IsReady)
{
Plot("Hello", "FastMA", EMAFast);
Plot("Hello", "SlowMA", EMASlow);
}
}
}
}