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 FOREXBasicTemplateAlgorithm : QCAlgorithm { private string _symbol = "EURUSD"; private AverageDirectionalIndex _adx; private SimpleMovingAverage _smaADX; public override void Initialize() { SetStartDate(2016, 3, 1); SetEndDate(2016, 3, 30); SetCash(1000); AddSecurity(SecurityType.Forex, _symbol, Resolution.Hour); _adx = ADX(_symbol, 30); _smaADX = new SimpleMovingAverage(_symbol + " SMA of ADX",10).Of(_adx); // Chart plotter = new Chart("ADX"); // plotter.AddSeries(new Series("ADX", SeriesType.Line, index:0)); // plotter.AddSeries(new Series("+", SeriesType.Line, index:0)); // plotter.AddSeries(new Series("-", SeriesType.Line, index:0)); // plotter.AddSeries(new Series("SMA", SeriesType.Line, index:0)); // AddChart(plotter); } public void OnData(TradeBars data) { if (!_adx.IsReady) return; if (!_smaADX.IsReady) return; Plot("ADX", "ADX", _adx); Plot("ADX", "SMA", _smaADX); Plot("ADX", "+", _adx.PositiveDirectionalIndex); Plot("ADX", "-", _adx.NegativeDirectionalIndex); if (!Portfolio.HoldStock) { //SetHoldings("EURUSD", 50, true); //Debug("Buying EURUSD on " + Time.ToShortDateString()); } } } }