Overall Statistics |
Total Trades 8 Average Win 0.51% Average Loss -2.49% Compounding Annual Return -33.475% Drawdown 2.600% Expectancy -0.097 Net Profit -1.00% Sharpe Ratio -2.413 Probabilistic Sharpe Ratio 26.816% Loss Rate 25% Win Rate 75% Profit-Loss Ratio 0.20 Alpha -0.115 Beta 0.221 Annual Standard Deviation 0.124 Annual Variance 0.015 Information Ratio 1.506 Tracking Error 0.353 Treynor Ratio -1.352 Total Fees $8.00 |
namespace QuantConnect.Algorithm.CSharp { public class QuantumHorizontalChamber : QCAlgorithm { private RelativeStrengthIndex _rsi; private decimal LastPrice; private string sym; public override void Initialize() { SetStartDate(2020, 3, 26); //Set Start Date SetCash(5000); //Set Strategy Cash sym = "SPY"; var spy = AddEquity(sym, Resolution.Minute); // spy.SetDataNormalizationMode(DataNormalizationMode.Raw); _rsi = RSI(sym, 14, MovingAverageType.Wilders, Resolution.Minute); SetWarmUp(TimeSpan.FromDays(4)); } /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// Slice object keyed by symbol containing the stock data public override void OnData(Slice data) { if (!_rsi.IsReady) return; if (_rsi < 30) Debug(data.Time.ToString() + ", RSI: " + _rsi); if (!Portfolio.Invested) { if(_rsi <= 25) MarketOrder(sym, 10); LastPrice = Securities[sym].Price; } else { if(_rsi >=40 && Portfolio[sym].UnrealizedProfit > 25) { Liquidate(); } else if(Portfolio[sym].UnrealizedProfit < -50){ Liquidate(); } } } } }