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
+49-10Lines changed: 49 additions & 10 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
-
*[Moving Average Convergence Divergence (MACD)](#moving-average-convergence-divergence-macd)
33
32
*[Momentum indicators](#momentum-indicators)
33
+
*[Moving Average Convergence Divergence (MACD)](#moving-average-convergence-divergence-macd)
34
34
*[Relative Strength Index (RSI)](#relative-strength-index-rsi)
35
35
*[Relative Strength Index Wilders method (Wilders RSI)](#wilders-relative-strength-index-wilders-rsi)
36
36
*[Williams %R](#williams-r)
@@ -46,15 +46,15 @@ Indicators that help to determine the direction of the market (uptrend, downtren
46
46
47
47
#### Weighted Moving Average (WMA)
48
48
49
-
Moving average that gives more weight to recent data points by applying a weighting factor to the data points.
49
+
A Weighted Moving Average (WMA) is a type of moving average that assigns greater importance to recent data points compared to older ones. This makes it more responsive to recent price changes compared to a Simple Moving Average (SMA), which treats all data points equally. The WMA does this by using linear weighting, where the most recent prices get the highest weight, and weights decrease linearly for older data points.
50
50
51
51
```python
52
52
defwma(
53
53
data: Union[PandasDataFrame, PolarsDataFrame],
54
54
source_column: str,
55
55
period: int,
56
56
result_column: Optional[str] =None
57
-
) -> Union[PandasDataFrame, PolarsDataFrame]
57
+
) -> Union[PandasDataFrame, PolarsDataFrame]:
58
58
```
59
59
60
60
Example
@@ -84,9 +84,18 @@ pd_df.tail(10)
84
84
85
85
#### Simple Moving Average (SMA)
86
86
87
-
Smooth out price data to identify trend direction.
87
+
A Simple Moving Average (SMA) is the average of the last N data points, recalculated as new data comes in. Unlike the Weighted Moving Average (WMA), SMA treats all values equally, giving them the same weight.
from investing_algorithm_framework import CSVOHLCVMarketDataSource
@@ -113,6 +122,19 @@ pd_df.tail(10)
113
122
114
123
#### Exponential Moving Average (EMA)
115
124
125
+
The Exponential Moving Average (EMA) is a type of moving average that gives more weight to recent prices, making it more responsive to price changes than a Simple Moving Average (SMA). It does this by using an exponential decay where the most recent prices get exponentially more weight.
126
+
127
+
```python
128
+
defema(
129
+
data: Union[PdDataFrame, PlDataFrame],
130
+
source_column: str,
131
+
period: int,
132
+
result_column: str=None,
133
+
) -> Union[PdDataFrame, PlDataFrame]:
134
+
```
135
+
136
+
Example
137
+
116
138
```python
117
139
from investing_algorithm_framework import CSVOHLCVMarketDataSource
Indicators that measure the strength and speed of price movements rather than the direction.
164
+
139
165
#### Moving Average Convergence Divergence (MACD)
140
166
167
+
The Moving Average Convergence Divergence (MACD) is used to identify trend direction, strength, and potential reversals. It is based on the relationship between two Exponential Moving Averages (EMAs) and includes a histogram to visualize momentum.
168
+
169
+
```python
170
+
defmacd(
171
+
data: Union[PdDataFrame, PlDataFrame],
172
+
source_column: str,
173
+
short_period: int=12,
174
+
long_period: int=26,
175
+
signal_period: int=9,
176
+
macd_column: str="macd",
177
+
signal_column: str="macd_signal",
178
+
histogram_column: str="macd_histogram"
179
+
) -> Union[PdDataFrame, PlDataFrame]:
180
+
```
181
+
182
+
Example
183
+
141
184
```python
142
185
from investing_algorithm_framework import CSVOHLCVMarketDataSource
0 commit comments