Overall Statistics |
Total Trades 48 Average Win 1.48% Average Loss -1.66% Compounding Annual Return 2.744% Drawdown 16.100% Expectancy 0.209 Net Profit 14.515% Sharpe Ratio 0.378 Probabilistic Sharpe Ratio 5.925% Loss Rate 36% Win Rate 64% Profit-Loss Ratio 0.89 Alpha 0.024 Beta 0.003 Annual Standard Deviation 0.064 Annual Variance 0.004 Information Ratio -0.702 Tracking Error 0.18 Treynor Ratio 8.136 Total Fees $0.00 Estimated Strategy Capacity $570000.00 Lowest Capacity Asset EURUSD 8G |
using System; namespace QuantConnect.Algorithm.CSharp { public class BootCampTask : QCAlgorithm { ExponentialMovingAverage ema; public override void Initialize() { SetStartDate(2016, 6, 09); SetEndDate(2021, 6, 09); SetCash(100000); Symbol symbol = AddForex("EURUSD", Resolution.Daily).Symbol; ema = EMA("EURUSD", 20, Resolution.Daily); SetWarmup(20); } public override void OnData(Slice data) { if (IsWarmingUp) return; decimal buyPrice = Math.Round(ema * 0.99m, 2); decimal sellPrice = Math.Round(ema * 1.01m, 2); Transactions.CancelOpenOrders(); if (Portfolio["EURUSD"].Quantity <= 0) { decimal quantity = Portfolio.TotalPortfolioValue / buyPrice - Portfolio["EURUSD"].Quantity; quantity = Math.Floor(quantity); LimitOrder("EURUSD", quantity, buyPrice); } else if (Portfolio["EURUSD"].Quantity > 0) { decimal quantity = -Portfolio.TotalPortfolioValue / sellPrice - Portfolio["EURUSD"].Quantity; quantity = Math.Ceiling(quantity); LimitOrder("EURUSD", quantity, sellPrice); } } } }