File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,18 @@ impl BarBuilder {
233
233
self . close = self . last_close ;
234
234
}
235
235
236
+ if let ( Some ( close) , Some ( low) ) = ( self . close , self . low ) {
237
+ if close < low {
238
+ self . low = Some ( close) ;
239
+ }
240
+ }
241
+
242
+ if let ( Some ( close) , Some ( high) ) = ( self . close , self . high ) {
243
+ if close > high {
244
+ self . high = Some ( close) ;
245
+ }
246
+ }
247
+
236
248
// SAFETY: The open was checked, so we can assume all prices are Some
237
249
let bar = Bar :: new (
238
250
self . bar_type ,
Original file line number Diff line number Diff line change @@ -188,10 +188,10 @@ cdef class BarBuilder:
188
188
self ._low = bar.low
189
189
self .initialized = True
190
190
else :
191
- if bar.high > self ._high:
191
+ if bar.high._mem.raw > self ._high._mem.raw :
192
192
self ._high = bar.high
193
193
194
- if bar.low < self ._low:
194
+ if bar.low._mem.raw < self ._low._mem.raw :
195
195
self ._low = bar.low
196
196
197
197
self ._close = bar.close
@@ -245,6 +245,9 @@ cdef class BarBuilder:
245
245
self ._low = self ._last_close
246
246
self ._close = self ._last_close
247
247
248
+ self ._low._mem.raw = min (self ._close._mem.raw, self ._low._mem.raw)
249
+ self ._high._mem.raw = max (self ._close._mem.raw, self ._max._mem.raw)
250
+
248
251
cdef Bar bar = Bar(
249
252
bar_type = self ._bar_type,
250
253
open = self ._open,
You can’t perform that action at this time.
0 commit comments