public override void setNextData(long _timestamp, double _value) { if (_timestamp < timestampNow) { throw new Exception("Cant add older data here!"); } if (_timestamp == timestampNow && _value != valueNow) { throw new Exception("Same timestamp different value!"); } if (_timestamp == timestampNow && _value == valueNow) { return; } timestampNow = _timestamp; valueNow = _value; double tmpDiff = rsi.getIndicator().value - signalMa.getIndicator().value; if (tmpDiff != 0d) { lastDifference = tmpDiff; } rsi.setNextData(_timestamp, _value); signalMa.setNextData(_timestamp, rsi.getIndicator().value); }
public override double getIndicator() { double output; if (rsi.getIndicator() < border) { output = 0; } else if (rsi.getIndicator() > 1 - border) { output = 1; } else { output = 0.5; } return(output); }
public override TimeValueData getIndicator() { double output; if (rsi.getIndicator().value < border) { output = 0; } else if (rsi.getIndicator().value > 1 - border) { output = 1; } else { output = 0.5; } return(new TimeValueData(timestampNow, output)); }
public override void setNextData(long _timestamp, double _value) { if (_timestamp < timestampNow) { throw new Exception("Cant add older data here!"); } if (_timestamp == timestampNow && _value != valueNow) { throw new Exception("Same timestamp different value!"); } if (_timestamp == timestampNow && _value == valueNow) { return; } lastSeenValue = rsi.getIndicator().value; rsi.setNextData(_timestamp, _value); timestampNow = _timestamp; valueNow = _value; }