keltner_channel
¤
keltner_channel
¤
keltner_channel(
dataframe: DataFrame,
ma: int = 20,
ma_mode: Literal[
"sma",
"ema",
"wma",
"dema",
"tema",
"trima",
"kama",
"mama",
"t3",
] = "ema",
atr: int = 20,
shift: float = 1.6,
prefix: str = "kc_",
inplace: bool = False,
plot: bool | list[str] = False,
plot_kwargs: dict | None = None,
) -> dict[str, Series] | DataFrame
summary
Parameters:
-
dataframe
(DataFrame
) –description
-
ma
(int
, default:20
) –description. Defaults to 20.
-
ma_mode
(Literal['sma', 'ema', 'wma', 'dema', 'tema', 'trima', 'kama', 'mama', 't3']
, default:'ema'
) –description. Defaults to "ema".
-
atr
(int
, default:20
) –description. Defaults to 20.
-
shift
(float
, default:1.6
) –description. Defaults to 1.6.
-
prefix
(str
, default:'kc_'
) –description. Defaults to "kc_".
-
inplace
(bool
, default:False
) –description. Defaults to False.
-
plot
(bool | list
, default:False
) –description. Defaults to False.
-
plot_kwargs
(dict | None
, default:None
) –description. Defaults to None.
Example
df.i.keltner_channel(ma=20, atr=20, shift=1.6, inplace=True, plot=True)
Raises:
-
RuntimeError
–description
Returns:
-
dict[str, Series] | DataFrame
–dict[str, pd.Series] | pd.DataFrame: {kc_upper, kc_middle, kc_lower}
Source code in lettrade/indicator/volatility/keltner_channel.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|