public override void GetAll(IIndicatorValues Ind) { int period = (int)this.IndicatorParameters.List[0]; if (!Ind.MomentumAbsolute(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 MomentumAbsolute(); } else { prototype = (MomentumAbsolute)Ind.MomentumAbsolute(period)[1].Clone(); } Get(ref prototype, Ind); Ind.MomentumAbsolute(period)[0] = (MomentumAbsolute)prototype; Ind.MomentumAbsolute(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) { MomentumAbsolute mom = Data.MomentumAbsolute(IndicatorParameters)[Instant.ExposureDate]; if (mom != null) { return(String.Format("{0}|{1}|{2}|", mom.Value, (int)mom.Direction, mom.Direction)); } else { return(String.Format("{0}|{1}|{2}|", "", "", "")); } }