16 using System.Collections.Generic;
30 private readonly
int _fastPeriod;
31 private readonly
int _slowPeriod;
33 private readonly
int _predictionInterval;
52 _fastPeriod = fastPeriod;
53 _slowPeriod = slowPeriod;
54 _resolution = resolution;
55 _predictionInterval = fastPeriod;
57 Name = $
"{nameof(EmaCrossAlphaModel)}({fastPeriod},{slowPeriod},{resolution})";
69 var insights =
new List<Insight>();
72 if (symbolData.Fast.IsReady && symbolData.Slow.IsReady)
74 var insightPeriod = _resolution.ToTimeSpan().Multiply(_predictionInterval);
75 if (symbolData.FastIsOverSlow)
77 if (symbolData.Slow > symbolData.Fast)
82 else if (symbolData.SlowIsOverFast)
84 if (symbolData.Fast > symbolData.Slow)
91 symbolData.FastIsOverSlow = symbolData.Fast > symbolData.Slow;
104 foreach (var added
in changes.AddedSecurities)
114 symbolData.Fast.Reset();
115 symbolData.Slow.Reset();
119 foreach (var removed
in changes.RemovedSecurities)
141 private readonly
Security _security;
179 _algorithm = algorithm;
180 _security = security;
204 _algorithm.SubscriptionManager.RemoveConsolidator(
Symbol, _fastConsolidator);
205 _algorithm.SubscriptionManager.RemoveConsolidator(
Symbol, _slowConsolidator);