Beispiel #1
0
        public override void GetAll(IIndicatorValues Ind)
        {
            int fastPeriod = (int)this.IndicatorParameters.List[0];
            int slowPeriod = (int)this.IndicatorParameters.List[1];

            if (!Ind.EmaPair(fastPeriod, slowPeriod).IsPopulated)
            {
                int oldCurrentBar = Ind.Bar.CurrentBar;
                for (int i = 1; i <= Ind.Bar.MaxBar; i++)
                {
                    Ind.Bar.CurrentBar = i;

                    object prototype = null;
                    if (i == 1)
                    {
                        prototype = new EMAPair();
                    }
                    else
                    {
                        prototype = (EMAPair)Ind.EmaPair(fastPeriod, slowPeriod)[1].Clone();
                    }

                    Get(ref prototype, Ind);

                    Ind.EmaPair(fastPeriod, slowPeriod)[0] = (EMAPair)prototype;

                    Ind.EmaPair(fastPeriod, slowPeriod).IsPopulated = true;                     // set here so instance is guaranteed to exits
                }

                Ind.Bar.CurrentBar = oldCurrentBar;
            }
        }
Beispiel #2
0
        protected override string GetPresentDetail(IOutputInstant Instant, IIndicatorValues Data, IndicatorParameters IndicatorParameters)
        {
            int fastPeriod = (int)IndicatorParameters.List[0];
            int slowPeriod = (int)IndicatorParameters.List[1];

            EMAPair emaPair = Data.EmaPair(fastPeriod, slowPeriod)[Instant.ExposureDate];

            return(String.Format("{0}|{1}|{2}|{3}|",
                                 (emaPair == null) ? "" : Convert.ToString(emaPair.Fast),
                                 (emaPair == null) ? "" : Convert.ToString(emaPair.Slow),
                                 (int)emaPair.Direction,
                                 emaPair.Direction));
        }