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.SMAPair(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 SMAPair();
                    }
                    else
                    {
                        prototype = (SMAPair)Ind.SMAPair(fastPeriod, slowPeriod)[1].Clone();
                    }

                    Get(ref prototype, Ind);

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

                    Ind.SMAPair(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)
        {
            SMAPair sma = Data.SMAPair(IndicatorParameters)[Instant.ExposureDate];

            if (sma != null)
            {
                return(String.Format("{0}|{1}|{2}|{3}|", sma.Fast, sma.Slow, (int)sma.Direction, sma.Direction));
            }
            else
            {
                return(String.Format("{0}|{1}|{2}|{3}|", "", "", "", ""));
            }
        }