예제 #1
0
        public void BuildCore(ISessionIndicator sessionIndicator)
        {
            string coreIdentityCode = StochasticsCore.CreateIdentityCode(periods);

            core = sessionIndicator.CoreIndicators.ContainsKey(coreIdentityCode) ? sessionIndicator.CoreIndicators[coreIdentityCode].IndicatorInstance as StochasticsCore : null;
            if (core == null)
            {
                string          priceChangeIdentityCode = PriceChangeCore.CreateIdentityCode();
                PriceChangeCore priceChangeCore         = sessionIndicator.CoreIndicators.ContainsKey(priceChangeIdentityCode) ? sessionIndicator.CoreIndicators[priceChangeIdentityCode].IndicatorInstance as PriceChangeCore : null;
                if (priceChangeCore == null)
                {
                    priceChangeCore = PriceChangeCore.CreateInstance(barType);
                    sessionIndicator.CoreIndicators.Add(priceChangeCore.IdentityCode, new CoreIndicator(priceChangeCore));
                }

                string           highsAndLowsIdentityCode = HighsAndLowsCore.CreateIdentityCode(periods);
                HighsAndLowsCore highsAndLowsCore         = sessionIndicator.CoreIndicators.ContainsKey(highsAndLowsIdentityCode) ? sessionIndicator.CoreIndicators[highsAndLowsIdentityCode].IndicatorInstance as HighsAndLowsCore : null;
                if (highsAndLowsCore == null)
                {
                    highsAndLowsCore = HighsAndLowsCore.CreateInstance(barType, periods);
                    sessionIndicator.CoreIndicators.Add(highsAndLowsCore.IdentityCode, new CoreIndicator(highsAndLowsCore));
                }

                if (smoothedPercentK)
                {
                    core = StochasticsCore.CreateInstance(barType, periods, smoothedPercentKPeriods, smoothedPercentDPeriods, priceChangeCore, highsAndLowsCore, this.OnCalculationCompleted);
                }
                else
                {
                    core = StochasticsCore.CreateInstance(barType, periods, smoothedPercentK, priceChangeCore, highsAndLowsCore, this.OnCalculationCompleted);
                }

                sessionIndicator.CoreIndicators.Add(core.IdentityCode, new CoreIndicator(core));
            }
        }
예제 #2
0
        public void BuildCore(ISessionIndicator sessionIndicator)
        {
            string coreIdentityCode = RSICore.CreateIdentityCode(periods);

            core = sessionIndicator.CoreIndicators.ContainsKey(coreIdentityCode) ? sessionIndicator.CoreIndicators[coreIdentityCode].IndicatorInstance as RSICore : null;
            if (core == null)
            {
                string          priceChangeIdentityCode = PriceChangeCore.CreateIdentityCode();
                PriceChangeCore priceChangeCore         = sessionIndicator.CoreIndicators.ContainsKey(priceChangeIdentityCode) ? sessionIndicator.CoreIndicators[priceChangeIdentityCode].IndicatorInstance as PriceChangeCore : null;
                if (priceChangeCore == null)
                {
                    priceChangeCore = PriceChangeCore.CreateInstance(barType);
                    sessionIndicator.CoreIndicators.Add(priceChangeCore.IdentityCode, new CoreIndicator(priceChangeCore));
                }

                core = RSICore.CreateInstance(barType, periods, priceChangeCore, this.OnCalculationCompleted);
                sessionIndicator.CoreIndicators.Add(core.IdentityCode, new CoreIndicator(core));
            }
        }