mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-11 23:07:01 +08:00
fix(market): handle invalid period in calculateDonchian
This commit is contained in:
@@ -1213,7 +1213,7 @@ func ExportCalculateBOLL(klines []Kline, period int, multiplier float64) (upper,
|
||||
|
||||
// calculateDonchian calculates Donchian channel (highest high, lowest low) for given period
|
||||
func calculateDonchian(klines []Kline, period int) (upper, lower float64) {
|
||||
if len(klines) == 0 {
|
||||
if len(klines) == 0 || period <= 0 {
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user