Overall Statistics |
Total Trades 128 Average Win 2.83% Average Loss -3.66% Compounding Annual Return 22.557% Drawdown 43.600% Expectancy 0.243 Net Profit 176.795% Sharpe Ratio 0.908 Probabilistic Sharpe Ratio 33.001% Loss Rate 30% Win Rate 70% Profit-Loss Ratio 0.77 Alpha 0.204 Beta -0.01 Annual Standard Deviation 0.223 Annual Variance 0.05 Information Ratio 0.18 Tracking Error 0.281 Treynor Ratio -20.673 Total Fees $0.00 Estimated Strategy Capacity $660000.00 Lowest Capacity Asset EURUSD 8G |
using System; namespace QuantConnect.Algorithm.CSharp { public class BootCampTask : QCAlgorithm { Stochastic stochastic; public override void Initialize() { SetStartDate(2016, 6, 1); SetEndDate(2021, 6, 1); SetCash(10000); AddForex("EURUSD", Resolution.Hour); stochastic = STO("EURUSD", 240, Resolution.Hour); SetWarmup(240); } public override void OnData(Slice data) { if (IsWarmingUp) return; if (!stochastic.IsReady) return; if (stochastic < 20) { if (!Portfolio["EURUSD"].Invested) { MarketOrder("EURUSD", 50000); } else if (Portfolio["EURUSD"].IsShort) { MarketOrder("EURUSD", 100000); } } else if (stochastic > 80) { if (!Portfolio["EURUSD"].Invested) { MarketOrder("EURUSD", -50000); } else if (Portfolio["EURUSD"].IsLong) { MarketOrder("EURUSD", -100000); } } } public override void OnOrderEvent(OrderEvent orderEvent) { if (orderEvent.Status == OrderStatus.Filled) { Debug("Euros=" + Portfolio.CashBook["EUR"].Amount); Debug("Dollars=" + Portfolio.CashBook["USD"].Amount); } } } }