Beispiel #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));
            }
        }
Beispiel #2
0
        private RSICore(BarItemType barItemType, int periods, PriceChangeCore priceChangeCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
            : base(DISPLAY_NAME, SHORT_NAME, DESCRIPTION, barItemType)
        {
            this.barCount    = periods;
            this.maxBarIndex = periods - 1;

            this.AddDependency(barItemType, priceChangeCore);

            this.priceChangeCore = priceChangeCore;

            this.identityCode = CreateIdentityCode(periods);

            if (onCalculationCompleted != null)
            {
                this.Calculated += onCalculationCompleted;
            }
        }
Beispiel #3
0
        private void Init(BarItemType barItemType, int periods, PriceChangeCore priceChangeCore, HighsAndLowsCore highsAndLowsCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
        {
            this.barCount    = periods;
            this.maxBarIndex = barCount - 1;
            this.percentDSmoothingConstant = (double)2 / (smoothedPercentDPeriods + 1);

            this.AddDependency(barItemType, highsAndLowsCore);
            this.AddDependency(barItemType, priceChangeCore);

            this.highsAndLows = highsAndLowsCore;
            this.priceChange  = priceChangeCore;

            this.identityCode = CreateIdentityCode(periods);

            if (onCalculationCompleted != null)
            {
                this.Calculated += onCalculationCompleted;
            }
        }
Beispiel #4
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));
            }
        }
Beispiel #5
0
 public static StochasticsCore CreateInstance(BarItemType barItemType, int periods, int smoothedPercentKPeriods, int smoothedPercentDPeriods, PriceChangeCore priceChangeCore, HighsAndLowsCore highsAndLowsCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
 {
     return(new StochasticsCore(barItemType, periods, smoothedPercentKPeriods, smoothedPercentDPeriods, priceChangeCore, highsAndLowsCore, onCalculationCompleted));
 }
Beispiel #6
0
 //Full stochastics
 private StochasticsCore(BarItemType barItemType, int periods, int smoothedPercentKPeriods, int smoothedPercentDPeriods, PriceChangeCore priceChangeCore, HighsAndLowsCore highsAndLowsCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
     : base(DISPLAY_NAME, SHORT_NAME, DESCRIPTION, barItemType)
 {
     this.smoothedPercentK        = true;
     this.smoothedPercentKPeriods = smoothedPercentKPeriods;
     this.smoothedPercentDPeriods = smoothedPercentDPeriods;
     Init(barItemType, periods, priceChangeCore, highsAndLowsCore, onCalculationCompleted);
 }
Beispiel #7
0
 public static RSICore CreateInstance(BarItemType barItemType, int periods, PriceChangeCore priceChangeCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
 {
     return(new RSICore(barItemType, periods, priceChangeCore, onCalculationCompleted));
 }