public SignalAndValue Process(Candle candle) { var fmResult = _smaFm.Process(candle); var smResult = _smaSm.Process(candle); return(new SignalAndValue(fmResult.Value - smResult.Value, _smaFm.IsFormed && _smaSm.IsFormed)); }
public override SignalAndValue Process(Candle candle) { var newValue = candle.CloseAsk; var smaValue = _sma.Process(newValue, candle.IsComplete == 1); var buff = Buffer; if (candle.IsComplete == 0) { buff = Buffer.ToList(); } buff.Add(newValue); if (buff.Count > Length) { buff.RemoveAt(0); } var std = buff.Select(t1 => t1 - smaValue.Value).Select(t => t * t).Sum(); var ret = new SignalAndValue((float)Math.Sqrt((double)(std / Length)), IsFormed); CurrentValue = ret.Value; return(ret); }
public SignalAndValue Process(Candle candle) { var ma = _movingAverage.Process(GetTrueRange(candle, _prevCandle), _prevCandle.IsComplete == 1); IsFormed = ma.IsFormed; _prevCandle = candle; return(new SignalAndValue(ma.Value, ma.IsFormed)); }
public SignalAndValue Process(Candle candle) { _dev.Process(candle); _sma.Process(candle); return(new SignalAndValue( _sma.CurrentValue + (_width * _dev.CurrentValue), _sma.IsFormed && _dev.IsFormed)); }