private BollingerBandsCore(BarItemType barItemType, int barCount, SMACore smaCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null, double stdMultiplier = 2) : base(DISPLAY_NAME, SHORT_NAME, DESCRIPTION, barItemType) { this.barCount = barCount; this.maxBarIndex = barCount - 1; this.stdMultiplier = stdMultiplier; this.AddDependency(barItemType, smaCore); this.smaCore = smaCore; this.identityCode = CreateIdentityCode(barCount); if (onCalculationCompleted != null) { this.Calculated += onCalculationCompleted; } }
public void BuildCore(ISessionIndicator sessionIndicator) { string coreIdentityCode = BollingerBandsCore.CreateIdentityCode(periods); core = sessionIndicator.CoreIndicators.ContainsKey(coreIdentityCode) ? sessionIndicator.CoreIndicators[coreIdentityCode].IndicatorInstance as BollingerBandsCore : null; if (core == null) { string smaIdentityCode = SMACore.CreateIdentityCode(periods); SMACore smaCore = sessionIndicator.CoreIndicators.ContainsKey(smaIdentityCode)? sessionIndicator.CoreIndicators[smaIdentityCode].IndicatorInstance as SMACore: null; if (smaCore == null) { smaCore = SMACore.CreateInstance(barType, periods); sessionIndicator.CoreIndicators.Add(smaCore.IdentityCode, new CoreIndicator(smaCore)); } core = BollingerBandsCore.CreateInstance(barType, periods, smaCore, this.OnCalculationCompleted, stdMultiplier); sessionIndicator.CoreIndicators.Add(core.IdentityCode, new CoreIndicator(core)); } }
public static BollingerBandsCore CreateInstance(BarItemType barItemType, int barCount, SMACore smaCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null, double stdMultiplier = 2) { return(new BollingerBandsCore(barItemType, barCount, smaCore, onCalculationCompleted, stdMultiplier)); }