Closed CarlosLagarto closed 9 months ago
Hi ,
I am implementing a thing for displaying a candlestick chart with HeikinAshi candles.
But from what I have seen in the code,
fn new((): Self::Params, value: &Self::Input) -> Result<Self, Error> { Ok(Self { prev: Candle::from(value), }) } #[inline] fn next(&mut self, value: &Self::Input) -> Self::Output { let open = (self.prev.open() + self.prev.close()) * 0.5; let close = value.ohlc4(); Candle { open, high: value.high().max(open), low: value.low().min(open), close, volume: value.volume(), } }
prev is updated in fn new(), but never ever gets updated again, so it always have the initial value that result in what it seems to me incorrect value:
Or am I interpreting something wrong?
Yes, you are totally right. Thank you. Will fix soon
Fixed in https://github.com/amv-dev/yata/commit/e7ba686d23bd2c2245351a0979b851bc6c8348b0
Thanks amd-dev.
Hi ,
I am implementing a thing for displaying a candlestick chart with HeikinAshi candles.
But from what I have seen in the code,
prev is updated in fn new(), but never ever gets updated again, so it always have the initial value that result in what it seems to me incorrect value:
Or am I interpreting something wrong?