You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-43Lines changed: 45 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,8 +29,8 @@ pip install pyindicators
29
29
*[Weighted Moving Average (WMA)](#weighted-moving-average-wma)
30
30
*[Simple Moving Average (SMA)](#simple-moving-average-sma)
31
31
*[Exponential Moving Average (EMA)](#exponential-moving-average-ema)
32
+
*[SuperTrend](#supertrend)
32
33
*[SuperTrend Clustering](#supertrend-clustering)
33
-
*[SuperTrend Basic](#supertrend-basic)
34
34
*[Momentum and Oscillators](#momentum-and-oscillators)
35
35
*[Moving Average Convergence Divergence (MACD)](#moving-average-convergence-divergence-macd)
36
36
*[Relative Strength Index (RSI)](#relative-strength-index-rsi)
@@ -910,6 +910,50 @@ pd_df.tail(10)
910
910
911
911
Indicators that combine trend detection with adaptive trailing stops.
912
912
913
+
#### SuperTrend
914
+
915
+
The SuperTrend indicator uses a fixed ATR multiplier factor to create a trend-following trailing stop. When the price is above the SuperTrend line the trend is bullish; when below, bearish. Trend changes generate buy/sell signals.
916
+
917
+
```python
918
+
defsupertrend(
919
+
data: Union[PdDataFrame, PlDataFrame],
920
+
atr_length: int=10,
921
+
factor: float=3.0
922
+
) -> Union[PdDataFrame, PlDataFrame]:
923
+
```
924
+
925
+
Returns the following columns:
926
+
-`supertrend`: The SuperTrend trailing stop value
927
+
-`supertrend_trend`: Current trend (1=bullish, 0=bearish)
928
+
-`supertrend_upper`: Upper band
929
+
-`supertrend_lower`: Lower band
930
+
-`supertrend_signal`: 1=buy signal, -1=sell signal, 0=no signal
931
+
932
+
Example
933
+
934
+
```python
935
+
from investing_algorithm_framework import download
The SuperTrend Clustering indicator uses K-means clustering to optimize the ATR multiplier factor for the SuperTrend calculation. It computes multiple SuperTrend variations with different factors, evaluates their performance, and clusters them into "best", "average", and "worst" groups. The best-performing factor is then used to generate an adaptive trailing stop with buy/sell signals.
The basic SuperTrend indicator uses a fixed ATR multiplier factor to create a trend-following trailing stop. When the price is above the SuperTrend line the trend is bullish; when below, bearish. Trend changes generate buy/sell signals.
982
-
983
-
```python
984
-
defsupertrend_basic(
985
-
data: Union[PdDataFrame, PlDataFrame],
986
-
atr_length: int=10,
987
-
factor: float=3.0
988
-
) -> Union[PdDataFrame, PlDataFrame]:
989
-
```
990
-
991
-
Returns the following columns:
992
-
-`supertrend`: The SuperTrend trailing stop value
993
-
-`supertrend_trend`: Current trend (1=bullish, 0=bearish)
994
-
-`supertrend_upper`: Upper band
995
-
-`supertrend_lower`: Lower band
996
-
-`supertrend_signal`: 1=buy signal, -1=sell signal, 0=no signal
997
-
998
-
Example
999
-
1000
-
```python
1001
-
from investing_algorithm_framework import download
0 commit comments