示例#1
0
        protected override String GetPresentDetail(IOutputInstant Instant, IIndicatorValues Data, IndicatorParameters IndicatorParameters)
        {
            VPFEChannel channel = Data.VPFEChannel(IndicatorParameters)[Instant.ExposureDate];

            if (channel != null)
            {
                return(String.Format("{0}|{1}|{2}|{3}|{4}|", channel.Lower, channel.Mid, channel.Upper, (int)channel.Oscillation, channel.Oscillation));
            }
            else
            {
                return(String.Format("{0}|{1}|{2}|{3}|{4}|", "", "", "", "", ""));
            }
        }
示例#2
0
        public override void GetAll(IIndicatorValues Ind)
        {
            int     period                 = (int)this.IndicatorParameters.List[0];
            int     volatilityPeriod       = (int)this.IndicatorParameters.List[1];
            Decimal volatilityMultiple     = (decimal)this.IndicatorParameters.List[2];
            int     pfePeriod              = (int)this.IndicatorParameters.List[3];
            int     pfeSmoothingPeriod     = (int)this.IndicatorParameters.List[4];
            decimal pfeThresholdPercentage = (decimal)this.IndicatorParameters.List[5];
            decimal pfeMultiple            = (decimal)this.IndicatorParameters.List[6];
            decimal marginThreshold        = (decimal)this.IndicatorParameters.List[7];
            decimal proximityMultiple      = (decimal)this.IndicatorParameters.List[8];

            if (!Ind.VPFEChannel(period, volatilityPeriod, volatilityMultiple, pfePeriod, pfeSmoothingPeriod, pfeThresholdPercentage, pfeMultiple, marginThreshold, proximityMultiple).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 VPFEChannel(marginThreshold);
                    }
                    else
                    {
                        prototype = (VPFEChannel)Ind.VPFEChannel(period, volatilityPeriod, volatilityMultiple, pfePeriod, pfeSmoothingPeriod, pfeThresholdPercentage, pfeMultiple, marginThreshold, proximityMultiple)[1].Clone();
                    }

                    Get(ref prototype, Ind);

                    Ind.VPFEChannel(period, volatilityPeriod, volatilityMultiple, pfePeriod, pfeSmoothingPeriod, pfeThresholdPercentage, pfeMultiple, marginThreshold, proximityMultiple)[0] = (VPFEChannel)prototype;

                    Ind.VPFEChannel(period, volatilityPeriod, volatilityMultiple, pfePeriod, pfeSmoothingPeriod, pfeThresholdPercentage, pfeMultiple, marginThreshold, proximityMultiple).IsPopulated = true;                     // set here so instance is guaranteed to exits
                }

                Ind.Bar.CurrentBar = oldCurrentBar;
            }
        }