public override void GetAll(IIndicatorValues Ind) { int period = (int)this.IndicatorParameters.List[0]; if (!Ind.MomentumRelative(period).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 MomentumRelative(); } else { prototype = (MomentumRelative)Ind.MomentumRelative(period)[1].Clone(); } Get(ref prototype, Ind); Ind.MomentumRelative(period)[0] = (MomentumRelative)prototype; Ind.MomentumRelative(period).IsPopulated = true; // set here so instance is guaranteed to exits } Ind.Bar.CurrentBar = oldCurrentBar; } }
protected override string GetPresentDetail(IOutputInstant Instant, IIndicatorValues Data, IndicatorParameters IndicatorParameters) { MomentumRelative momRelative = Data.MomentumRelative(IndicatorParameters)[Instant.ExposureDate]; if (momRelative != null) { return(String.Format("{0}|{1}|{2}|", momRelative.Value, (int)momRelative.Direction, momRelative.Direction)); } else { return(String.Format("{0}|{1}|{2}|", "", "", "")); } }