0
# Overlap Studies
1
2
Trend-following indicators and moving averages that smooth price data to identify trends and provide support/resistance levels. These indicators "overlay" on price charts and help traders identify trend direction and potential reversal points.
3
4
## Capabilities
5
6
### Simple Moving Average
7
8
Calculates the arithmetic mean of prices over a specified time period, providing trend direction and support/resistance levels.
9
10
```python { .api }
11
def SMA(real, timeperiod=30):
12
"""
13
Simple Moving Average
14
15
Parameters:
16
- real: array-like, input price data (typically close prices)
17
- timeperiod: int, number of periods for averaging (default: 30)
18
19
Returns:
20
numpy.ndarray: SMA values
21
"""
22
```
23
24
### Exponential Moving Average
25
26
Calculates exponentially weighted moving average giving more weight to recent prices, making it more responsive to price changes than SMA.
27
28
```python { .api }
29
def EMA(real, timeperiod=30):
30
"""
31
Exponential Moving Average
32
33
Parameters:
34
- real: array-like, input price data
35
- timeperiod: int, number of periods (default: 30)
36
37
Returns:
38
numpy.ndarray: EMA values
39
"""
40
```
41
42
### Bollinger Bands
43
44
Creates volatility bands around a moving average to identify overbought/oversold conditions and potential breakouts.
45
46
```python { .api }
47
def BBANDS(real, timeperiod=5, nbdevup=2, nbdevdn=2, matype=MA_Type.SMA):
48
"""
49
Bollinger Bands
50
51
Parameters:
52
- real: array-like, input price data
53
- timeperiod: int, moving average period (default: 5)
54
- nbdevup: float, upper band deviation multiplier (default: 2)
55
- nbdevdn: float, lower band deviation multiplier (default: 2)
56
- matype: MA_Type, moving average type (default: SMA)
57
58
Returns:
59
tuple: (upper_band, middle_band, lower_band)
60
"""
61
```
62
63
### Double Exponential Moving Average
64
65
Double-smoothed exponential moving average that reduces lag while maintaining smoothness.
66
67
```python { .api }
68
def DEMA(real, timeperiod=30):
69
"""
70
Double Exponential Moving Average
71
72
Parameters:
73
- real: array-like, input price data
74
- timeperiod: int, number of periods (default: 30)
75
76
Returns:
77
numpy.ndarray: DEMA values
78
"""
79
```
80
81
### Triple Exponential Moving Average
82
83
Triple-smoothed exponential moving average providing even less lag than DEMA.
84
85
```python { .api }
86
def TEMA(real, timeperiod=30):
87
"""
88
Triple Exponential Moving Average
89
90
Parameters:
91
- real: array-like, input price data
92
- timeperiod: int, number of periods (default: 30)
93
94
Returns:
95
numpy.ndarray: TEMA values
96
"""
97
```
98
99
### Triangular Moving Average
100
101
Double-smoothed simple moving average creating a triangular weighting pattern.
102
103
```python { .api }
104
def TRIMA(real, timeperiod=30):
105
"""
106
Triangular Moving Average
107
108
Parameters:
109
- real: array-like, input price data
110
- timeperiod: int, number of periods (default: 30)
111
112
Returns:
113
numpy.ndarray: TRIMA values
114
"""
115
```
116
117
### Weighted Moving Average
118
119
Linear weighted moving average giving more weight to recent prices in a linear fashion.
120
121
```python { .api }
122
def WMA(real, timeperiod=30):
123
"""
124
Weighted Moving Average
125
126
Parameters:
127
- real: array-like, input price data
128
- timeperiod: int, number of periods (default: 30)
129
130
Returns:
131
numpy.ndarray: WMA values
132
"""
133
```
134
135
### Kaufman Adaptive Moving Average
136
137
Adaptive moving average that adjusts its smoothing based on market volatility and trending conditions.
138
139
```python { .api }
140
def KAMA(real, timeperiod=30):
141
"""
142
Kaufman Adaptive Moving Average
143
144
Parameters:
145
- real: array-like, input price data
146
- timeperiod: int, number of periods (default: 30)
147
148
Returns:
149
numpy.ndarray: KAMA values
150
"""
151
```
152
153
### Moving Average
154
155
Generic moving average function allowing selection of different MA types.
156
157
```python { .api }
158
def MA(real, timeperiod=30, matype=MA_Type.SMA):
159
"""
160
Moving Average
161
162
Parameters:
163
- real: array-like, input price data
164
- timeperiod: int, number of periods (default: 30)
165
- matype: MA_Type, type of moving average (default: SMA)
166
167
Returns:
168
numpy.ndarray: Moving average values
169
"""
170
```
171
172
### MESA Adaptive Moving Average
173
174
Adaptive moving average based on MESA (Maximum Entropy Spectral Analysis) algorithm.
175
176
```python { .api }
177
def MAMA(real, fastlimit=0, slowlimit=0):
178
"""
179
MESA Adaptive Moving Average
180
181
Parameters:
182
- real: array-like, input price data
183
- fastlimit: float, fast limit (default: 0)
184
- slowlimit: float, slow limit (default: 0)
185
186
Returns:
187
tuple: (mama, fama) - MESA Adaptive MA and Following Adaptive MA
188
"""
189
```
190
191
### Moving Average Variable Period
192
193
Moving average with variable time periods allowing period changes over time.
194
195
```python { .api }
196
def MAVP(real, periods, minperiod=2, maxperiod=30, matype=MA_Type.SMA):
197
"""
198
Moving Average Variable Period
199
200
Parameters:
201
- real: array-like, input price data
202
- periods: float, period value for calculation
203
- minperiod: int, minimum period allowed (default: 2)
204
- maxperiod: int, maximum period allowed (default: 30)
205
- matype: MA_Type, moving average type (default: SMA)
206
207
Returns:
208
numpy.ndarray: Variable period MA values
209
"""
210
```
211
212
### MidPoint
213
214
Calculates the midpoint of the highest and lowest values over a specified period.
215
216
```python { .api }
217
def MIDPOINT(real, timeperiod=14):
218
"""
219
MidPoint over period
220
221
Parameters:
222
- real: array-like, input price data
223
- timeperiod: int, number of periods (default: 14)
224
225
Returns:
226
numpy.ndarray: Midpoint values
227
"""
228
```
229
230
### MidPrice
231
232
Calculates the midpoint of high and low prices over a specified period.
233
234
```python { .api }
235
def MIDPRICE(high, low, timeperiod=14):
236
"""
237
Midpoint Price over period
238
239
Parameters:
240
- high: array-like, high prices
241
- low: array-like, low prices
242
- timeperiod: int, number of periods (default: 14)
243
244
Returns:
245
numpy.ndarray: Midprice values
246
"""
247
```
248
249
### Parabolic SAR
250
251
Stop and Reverse system that provides trailing stop levels and trend reversal signals.
252
253
```python { .api }
254
def SAR(high, low, acceleration=0, maximum=0):
255
"""
256
Parabolic SAR
257
258
Parameters:
259
- high: array-like, high prices
260
- low: array-like, low prices
261
- acceleration: float, acceleration factor (default: 0)
262
- maximum: float, maximum acceleration (default: 0)
263
264
Returns:
265
numpy.ndarray: SAR values
266
"""
267
```
268
269
### Parabolic SAR Extended
270
271
Extended version of Parabolic SAR with additional customization parameters.
272
273
```python { .api }
274
def SAREXT(high, low, startvalue=0, offsetonreverse=0, accelerationinitlong=0,
275
accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0,
276
accelerationshort=0, accelerationmaxshort=0):
277
"""
278
Parabolic SAR Extended
279
280
Parameters:
281
- high: array-like, high prices
282
- low: array-like, low prices
283
- startvalue: float, start value (default: 0)
284
- offsetonreverse: float, offset on reverse (default: 0)
285
- accelerationinitlong: float, initial acceleration for long positions (default: 0)
286
- accelerationlong: float, acceleration for long positions (default: 0)
287
- accelerationmaxlong: float, maximum acceleration for long positions (default: 0)
288
- accelerationinitshort: float, initial acceleration for short positions (default: 0)
289
- accelerationshort: float, acceleration for short positions (default: 0)
290
- accelerationmaxshort: float, maximum acceleration for short positions (default: 0)
291
292
Returns:
293
numpy.ndarray: Extended SAR values
294
"""
295
```
296
297
### Triple Exponential Moving Average (T3)
298
299
Smoothed moving average with optional volume factor for fine-tuning responsiveness.
300
301
```python { .api }
302
def T3(real, timeperiod=5, vfactor=0):
303
"""
304
Triple Exponential Moving Average (T3)
305
306
Parameters:
307
- real: array-like, input price data
308
- timeperiod: int, number of periods (default: 5)
309
- vfactor: float, volume factor (default: 0)
310
311
Returns:
312
numpy.ndarray: T3 values
313
"""
314
```
315
316
### Hilbert Transform Trendline
317
318
Uses Hilbert Transform to generate instantaneous trendline values.
319
320
```python { .api }
321
def HT_TRENDLINE(real):
322
"""
323
Hilbert Transform - Instantaneous Trendline
324
325
Parameters:
326
- real: array-like, input price data
327
328
Returns:
329
numpy.ndarray: Trendline values
330
"""
331
```