Example #1
0
        public void BuildCore(ISessionIndicator sessionIndicator)
        {
            string coreIdentityCode = ADXCore.CreateIdentityCode(periods);

            core = sessionIndicator.CoreIndicators.ContainsKey(coreIdentityCode) ? sessionIndicator.CoreIndicators[coreIdentityCode].IndicatorInstance as ADXCore : null;
            if (core == null)
            {
                string        trueRangeIdentityCode = TrueRangeCore.CreateIdentityCode();
                TrueRangeCore trueRangeCore         = sessionIndicator.CoreIndicators.ContainsKey(trueRangeIdentityCode) ? sessionIndicator.CoreIndicators[trueRangeIdentityCode].IndicatorInstance as TrueRangeCore : null;
                if (trueRangeCore == null)
                {
                    trueRangeCore = TrueRangeCore.CreateInstance(barType);
                    sessionIndicator.CoreIndicators.Add(trueRangeCore.IdentityCode, new CoreIndicator(trueRangeCore));
                }

                string dmIdentityCode          = DirectionalMovementCore.CreateIdentityCode();
                DirectionalMovementCore dmCore = sessionIndicator.CoreIndicators.ContainsKey(dmIdentityCode) ? sessionIndicator.CoreIndicators[dmIdentityCode].IndicatorInstance as DirectionalMovementCore : null;
                if (dmCore == null)
                {
                    dmCore = DirectionalMovementCore.CreateInstance(barType);
                    sessionIndicator.CoreIndicators.Add(dmCore.IdentityCode, new CoreIndicator(dmCore));
                }

                string dxIdentityCode = DirectionalMovementIndexCore.CreateIdentityCode(periods);
                DirectionalMovementIndexCore dxCore = sessionIndicator.CoreIndicators.ContainsKey(dxIdentityCode) ? sessionIndicator.CoreIndicators[dxIdentityCode].IndicatorInstance as DirectionalMovementIndexCore : null;
                if (dxCore == null)
                {
                    dxCore = DirectionalMovementIndexCore.CreateInstance(barType, periods, trueRangeCore, dmCore);
                    sessionIndicator.CoreIndicators.Add(dxCore.IdentityCode, new CoreIndicator(dxCore));
                }

                core = ADXCore.CreateInstance(barType, periods, dxCore, this.OnCalculationCompleted);
                sessionIndicator.CoreIndicators.Add(core.IdentityCode, new CoreIndicator(core));
            }
        }
Example #2
0
        private ATRCore(BarItemType barItemType, int periods, TrueRangeCore trueRangeCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
            : base(DISPLAY_NAME, SHORT_NAME, DESCRIPTION, barItemType)
        {
            this.barCount    = periods;
            this.maxBarIndex = periods - 1;

            this.AddDependency(barItemType, trueRangeCore);

            this.trueRangeCore = trueRangeCore;

            this.identityCode = CreateIdentityCode(periods);

            if (onCalculationCompleted != null)
            {
                this.Calculated += onCalculationCompleted;
            }
        }
Example #3
0
        public void BuildCore(ISessionIndicator sessionIndicator)
        {
            string coreIdentityCode = ATRCore.CreateIdentityCode(periods);

            core = sessionIndicator.CoreIndicators.ContainsKey(coreIdentityCode) ? sessionIndicator.CoreIndicators[coreIdentityCode].IndicatorInstance as ATRCore : null;
            if (core == null)
            {
                string        trueRangeIdentityCode = TrueRangeCore.CreateIdentityCode();
                TrueRangeCore trueRangeCore         = sessionIndicator.CoreIndicators.ContainsKey(trueRangeIdentityCode) ? sessionIndicator.CoreIndicators[trueRangeIdentityCode].IndicatorInstance as TrueRangeCore : null;
                if (trueRangeCore == null)
                {
                    trueRangeCore = TrueRangeCore.CreateInstance(barType);
                    sessionIndicator.CoreIndicators.Add(trueRangeCore.IdentityCode, new CoreIndicator(trueRangeCore));
                }

                core = ATRCore.CreateInstance(barType, periods, trueRangeCore, this.OnCalculationCompleted);
                sessionIndicator.CoreIndicators.Add(core.IdentityCode, new CoreIndicator(core));
            }
        }
Example #4
0
 public static ATRCore CreateInstance(BarItemType barItemType, int periods, TrueRangeCore trueRangeCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
 {
     return(new ATRCore(barItemType, periods, trueRangeCore, onCalculationCompleted));
 }
Example #5
0
 public static DirectionalMovementIndexCore CreateInstance(BarItemType barItemType, int periods, TrueRangeCore trueRangeCore, DirectionalMovementCore directionalMovementCore, IndicatorDelegates.CalculationCompletedHandler onCalculationCompleted = null)
 {
     return(new DirectionalMovementIndexCore(barItemType, periods, trueRangeCore, directionalMovementCore, onCalculationCompleted));
 }