-
Fix RenkoConsolidator (#7317)
发布于
2023-06-16 21:36:56 +00:00 | 1362 次提交 在此版本后已推送到 master- Fix bug and add unit tests
The bug was raised because rounding the first point inserted in the
RenkoConsolidator didn't get the closest y-multiple of the given number
x, where y is the bar-size. In order to compute the first y-multiple of
the given number x, we need to first compute x mod y := x - y*Floor(x/y),
once we get this number we divide it by y to know if we should round x
to minimum y-multiple greater than x, or should round x to the maximum
y-multiple smaller than x. If (x mod y)/y < 0.5 we round down, otherwise we round up (the amount (x mod y)/y is always less than one and higher than 0). See the Art of Computer Programming, Vol I. Donald E. Knuth.- Add
GetClosestMultiple()method inRenkoConsolidator.cs - Add more unit tests
-
Nit change
-
Add XML docs
-
Address required changes and add more unit tests
下载附件