12345678910111213141516171819 |
- package indicator
- import (
- "git.beejay.kim/Gshopper/sentio/talib"
- )
- func AtrTrailingStopLoss(inHigh []float64, inLow []float64, inClose []float64, inTimePeriod int, multiplier float64, hhv int) []float64 {
- atr := talib.Atr(inHigh, inLow, inClose, inTimePeriod)
- sl := make([]float64, len(atr))
- for i := range atr {
- sl[i] = inClose[i] - multiplier*atr[i]
- }
- if hhv > 1 {
- sl = talib.Max(sl, hhv)
- }
- return sl
- }
|