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 Probabilistic 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.Algorithm.CSharp { public class CalibratedNadionContainmentField : QCAlgorithm { private string[] tickers = {"GOOG", "AMZN", "AAPL", "TLT", "SPY", "JNJ", "TSLA", "NFLX"}; private Dictionary<Symbol, SymbolData> symbolDict = new Dictionary<Symbol, SymbolData>(); public override void Initialize() { SetStartDate(2020, 2, 20); //Set Start Date SetCash(100000); //Set Strategy Cash foreach(var ticker in tickers){ var symbol = AddEquity(ticker, Resolution.Hour).Symbol; symbolDict.Add(symbol, new SymbolData(this, symbol)); } SetWarmUp(50); } public override void OnData(Slice data) { if(IsWarmingUp){ return; } foreach(var symbol in symbolDict.Keys){ var sd = symbolDict[symbol]; Log($"Symbol: {symbol} with fibonacci retracements 38.2%: {sd.fib_38_2}, 50.0%: {sd.fib_50_0}, 61.8%: {sd.fib_61_8} AND MAX: {sd.max} and MIN: {sd.min}"); } } } public class SymbolData { public Symbol symbol {get; set;} public QCAlgorithm algorithm {get; set;} public Maximum max; public Minimum min; public decimal fib_50_0 {get; set;} public decimal fib_61_8 {get; set;} public decimal fib_38_2 {get; set;} public SymbolData(QCAlgorithm _algorithm, Symbol _symbol){ symbol = _symbol; algorithm = _algorithm; max = algorithm.MAX(symbol, 50, Resolution.Hour); min = algorithm.MIN(symbol, 50, Resolution.Hour); // Update retracement levels with each new data point min.Updated += (s, u) => { var height = max - min; fib_50_0 = min + (height * (decimal)0.500); fib_61_8 = min + (height * (decimal)0.618); fib_38_2 = min + (height * (decimal)0.382); }; } } }