public override void GetAll(IIndicatorValues Ind) { int period = (int)this.IndicatorParameters.List[0]; int volatilityPeriod = (int)this.IndicatorParameters.List[1]; decimal volitilityMultiple = (decimal)this.IndicatorParameters.List[2]; decimal marginThreshold = (decimal)this.IndicatorParameters.List[3]; decimal proximityMultiple = (decimal)this.IndicatorParameters.List[4]; if (!Ind.VolatilityChannel(period, volatilityPeriod, volitilityMultiple, 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 VolatilityChannel(marginThreshold); } else { prototype = (VolatilityChannel)Ind.VolatilityChannel(period, volatilityPeriod, volitilityMultiple, marginThreshold, proximityMultiple)[1].Clone(); } Get(ref prototype, Ind); Ind.VolatilityChannel(period, volatilityPeriod, volitilityMultiple, marginThreshold, proximityMultiple)[0] = (VolatilityChannel)prototype; Ind.VolatilityChannel(period, volatilityPeriod, volitilityMultiple, marginThreshold, proximityMultiple).IsPopulated = true; // set here so instance is guaranteed to exits } Ind.Bar.CurrentBar = oldCurrentBar; } }
protected override String GetPresentDetail(IOutputInstant Instant, IIndicatorValues Data, IndicatorParameters IndicatorParameters) { VolatilityChannel channel = Data.VolatilityChannel(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}|", "", "", "", "", "")); } }