or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

abstract-streaming.mdcycle-indicators.mdindex.mdmath-operations.mdmomentum-indicators.mdoverlap-studies.mdpattern-recognition.mdprice-transform.mdstatistical-functions.mdvolatility-indicators.mdvolume-indicators.md

momentum-indicators.mddocs/

0

# Momentum Indicators

1

2

Oscillators and momentum-based indicators that measure the rate of price change and help identify overbought/oversold conditions, divergences, and potential reversal points. These indicators typically oscillate within defined ranges or show the momentum of price movements.

3

4

## Capabilities

5

6

### Relative Strength Index

7

8

Momentum oscillator that measures the speed and magnitude of price changes, ranging from 0 to 100.

9

10

```python { .api }

11

def RSI(real, timeperiod=14):

12

"""

13

Relative Strength Index

14

15

Parameters:

16

- real: array-like, input price data (typically close prices)

17

- timeperiod: int, number of periods (default: 14)

18

19

Returns:

20

numpy.ndarray: RSI values (0-100 range)

21

"""

22

```

23

24

### MACD

25

26

Moving Average Convergence Divergence - trend-following momentum indicator showing relationship between two moving averages.

27

28

```python { .api }

29

def MACD(real, fastperiod=12, slowperiod=26, signalperiod=9):

30

"""

31

Moving Average Convergence/Divergence

32

33

Parameters:

34

- real: array-like, input price data

35

- fastperiod: int, fast EMA period (default: 12)

36

- slowperiod: int, slow EMA period (default: 26)

37

- signalperiod: int, signal line EMA period (default: 9)

38

39

Returns:

40

tuple: (macd_line, signal_line, histogram)

41

"""

42

```

43

44

### MACD Extended

45

46

MACD with customizable moving average types for fast, slow, and signal lines.

47

48

```python { .api }

49

def MACDEXT(real, fastperiod=12, fastmatype=MA_Type.SMA, slowperiod=26,

50

slowmatype=MA_Type.SMA, signalperiod=9, signalmatype=MA_Type.SMA):

51

"""

52

MACD with controllable MA type

53

54

Parameters:

55

- real: array-like, input price data

56

- fastperiod: int, fast MA period (default: 12)

57

- fastmatype: MA_Type, fast MA type (default: SMA)

58

- slowperiod: int, slow MA period (default: 26)

59

- slowmatype: MA_Type, slow MA type (default: SMA)

60

- signalperiod: int, signal MA period (default: 9)

61

- signalmatype: MA_Type, signal MA type (default: SMA)

62

63

Returns:

64

tuple: (macd_line, signal_line, histogram)

65

"""

66

```

67

68

### MACD Fixed

69

70

MACD with fixed 12/26 periods, only allowing customization of signal period.

71

72

```python { .api }

73

def MACDFIX(real, signalperiod=9):

74

"""

75

Moving Average Convergence/Divergence Fix 12/26

76

77

Parameters:

78

- real: array-like, input price data

79

- signalperiod: int, signal line period (default: 9)

80

81

Returns:

82

tuple: (macd_line, signal_line, histogram)

83

"""

84

```

85

86

### Stochastic

87

88

Momentum oscillator comparing closing price to high-low range over a given time period.

89

90

```python { .api }

91

def STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=MA_Type.SMA,

92

slowd_period=3, slowd_matype=MA_Type.SMA):

93

"""

94

Stochastic

95

96

Parameters:

97

- high: array-like, high prices

98

- low: array-like, low prices

99

- close: array-like, close prices

100

- fastk_period: int, fast %K period (default: 5)

101

- slowk_period: int, slow %K period (default: 3)

102

- slowk_matype: MA_Type, slow %K MA type (default: SMA)

103

- slowd_period: int, slow %D period (default: 3)

104

- slowd_matype: MA_Type, slow %D MA type (default: SMA)

105

106

Returns:

107

tuple: (slowk, slowd) - %K and %D values

108

"""

109

```

110

111

### Fast Stochastic

112

113

Fast version of stochastic oscillator without additional smoothing.

114

115

```python { .api }

116

def STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=MA_Type.SMA):

117

"""

118

Stochastic Fast

119

120

Parameters:

121

- high: array-like, high prices

122

- low: array-like, low prices

123

- close: array-like, close prices

124

- fastk_period: int, fast %K period (default: 5)

125

- fastd_period: int, fast %D period (default: 3)

126

- fastd_matype: MA_Type, fast %D MA type (default: SMA)

127

128

Returns:

129

tuple: (fastk, fastd) - Fast %K and %D values

130

"""

131

```

132

133

### Stochastic RSI

134

135

Stochastic oscillator applied to RSI values instead of price data.

136

137

```python { .api }

138

def STOCHRSI(real, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=MA_Type.SMA):

139

"""

140

Stochastic Relative Strength Index

141

142

Parameters:

143

- real: array-like, input price data

144

- timeperiod: int, RSI period (default: 14)

145

- fastk_period: int, fast %K period (default: 5)

146

- fastd_period: int, fast %D period (default: 3)

147

- fastd_matype: MA_Type, fast %D MA type (default: SMA)

148

149

Returns:

150

tuple: (fastk, fastd) - Stochastic RSI %K and %D values

151

"""

152

```

153

154

### Average Directional Movement Index

155

156

Measures trend strength regardless of direction, ranging from 0 to 100.

157

158

```python { .api }

159

def ADX(high, low, close, timeperiod=14):

160

"""

161

Average Directional Movement Index

162

163

Parameters:

164

- high: array-like, high prices

165

- low: array-like, low prices

166

- close: array-like, close prices

167

- timeperiod: int, number of periods (default: 14)

168

169

Returns:

170

numpy.ndarray: ADX values (0-100 range)

171

"""

172

```

173

174

### ADX Rating

175

176

Smoothed version of ADX providing additional filtering.

177

178

```python { .api }

179

def ADXR(high, low, close, timeperiod=14):

180

"""

181

Average Directional Movement Index Rating

182

183

Parameters:

184

- high: array-like, high prices

185

- low: array-like, low prices

186

- close: array-like, close prices

187

- timeperiod: int, number of periods (default: 14)

188

189

Returns:

190

numpy.ndarray: ADXR values

191

"""

192

```

193

194

### Commodity Channel Index

195

196

Momentum-based oscillator used to identify cyclical trends and overbought/oversold conditions.

197

198

```python { .api }

199

def CCI(high, low, close, timeperiod=14):

200

"""

201

Commodity Channel Index

202

203

Parameters:

204

- high: array-like, high prices

205

- low: array-like, low prices

206

- close: array-like, close prices

207

- timeperiod: int, number of periods (default: 14)

208

209

Returns:

210

numpy.ndarray: CCI values

211

"""

212

```

213

214

### Aroon

215

216

Identifies trend changes and measures trend strength by calculating time since highest high and lowest low.

217

218

```python { .api }

219

def AROON(high, low, timeperiod=14):

220

"""

221

Aroon

222

223

Parameters:

224

- high: array-like, high prices

225

- low: array-like, low prices

226

- timeperiod: int, number of periods (default: 14)

227

228

Returns:

229

tuple: (aroondown, aroonup) - Aroon Down and Up values

230

"""

231

```

232

233

### Aroon Oscillator

234

235

Difference between Aroon Up and Aroon Down, ranging from -100 to +100.

236

237

```python { .api }

238

def AROONOSC(high, low, timeperiod=14):

239

"""

240

Aroon Oscillator

241

242

Parameters:

243

- high: array-like, high prices

244

- low: array-like, low prices

245

- timeperiod: int, number of periods (default: 14)

246

247

Returns:

248

numpy.ndarray: Aroon Oscillator values (-100 to +100)

249

"""

250

```

251

252

### Williams %R

253

254

Momentum indicator similar to stochastic, measuring overbought/oversold levels.

255

256

```python { .api }

257

def WILLR(high, low, close, timeperiod=14):

258

"""

259

Williams' %R

260

261

Parameters:

262

- high: array-like, high prices

263

- low: array-like, low prices

264

- close: array-like, close prices

265

- timeperiod: int, number of periods (default: 14)

266

267

Returns:

268

numpy.ndarray: Williams %R values (-100 to 0 range)

269

"""

270

```

271

272

### Momentum

273

274

Rate of change indicator showing the difference between current and historical prices.

275

276

```python { .api }

277

def MOM(real, timeperiod=10):

278

"""

279

Momentum

280

281

Parameters:

282

- real: array-like, input price data

283

- timeperiod: int, number of periods (default: 10)

284

285

Returns:

286

numpy.ndarray: Momentum values

287

"""

288

```

289

290

### Rate of Change

291

292

Percentage change between current and historical prices.

293

294

```python { .api }

295

def ROC(real, timeperiod=10):

296

"""

297

Rate of change: ((price/prevPrice)-1)*100

298

299

Parameters:

300

- real: array-like, input price data

301

- timeperiod: int, number of periods (default: 10)

302

303

Returns:

304

numpy.ndarray: ROC percentage values

305

"""

306

```

307

308

### Rate of Change Percentage

309

310

Alternative rate of change calculation.

311

312

```python { .api }

313

def ROCP(real, timeperiod=10):

314

"""

315

Rate of change Percentage: (price-prevPrice)/prevPrice

316

317

Parameters:

318

- real: array-like, input price data

319

- timeperiod: int, number of periods (default: 10)

320

321

Returns:

322

numpy.ndarray: ROCP values

323

"""

324

```

325

326

### Rate of Change Ratio

327

328

Ratio-based rate of change calculation.

329

330

```python { .api }

331

def ROCR(real, timeperiod=10):

332

"""

333

Rate of change ratio: (price/prevPrice)

334

335

Parameters:

336

- real: array-like, input price data

337

- timeperiod: int, number of periods (default: 10)

338

339

Returns:

340

numpy.ndarray: ROCR values

341

"""

342

```

343

344

### Rate of Change Ratio 100

345

346

Ratio-based ROC scaled to 100.

347

348

```python { .api }

349

def ROCR100(real, timeperiod=10):

350

"""

351

Rate of change ratio 100 scale: (price/prevPrice)*100

352

353

Parameters:

354

- real: array-like, input price data

355

- timeperiod: int, number of periods (default: 10)

356

357

Returns:

358

numpy.ndarray: ROCR100 values

359

"""

360

```

361

362

### Additional Momentum Indicators

363

364

```python { .api }

365

def APO(real, fastperiod=12, slowperiod=26, matype=MA_Type.SMA):

366

"""Absolute Price Oscillator"""

367

368

def BOP(open, high, low, close):

369

"""Balance Of Power"""

370

371

def CMO(real, timeperiod=14):

372

"""Chande Momentum Oscillator"""

373

374

def DX(high, low, close, timeperiod=14):

375

"""Directional Movement Index"""

376

377

def MFI(high, low, close, volume, timeperiod=14):

378

"""Money Flow Index"""

379

380

def MINUS_DI(high, low, close, timeperiod=14):

381

"""Minus Directional Indicator"""

382

383

def MINUS_DM(high, low, timeperiod=14):

384

"""Minus Directional Movement"""

385

386

def PLUS_DI(high, low, close, timeperiod=14):

387

"""Plus Directional Indicator"""

388

389

def PLUS_DM(high, low, timeperiod=14):

390

"""Plus Directional Movement"""

391

392

def PPO(real, fastperiod=12, slowperiod=26, matype=MA_Type.SMA):

393

"""Percentage Price Oscillator"""

394

395

def TRIX(real, timeperiod=30):

396

"""1-day Rate-Of-Change (ROC) of a Triple Smooth EMA"""

397

398

def ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28):

399

"""Ultimate Oscillator"""

400

401

def IMI(open, close, timeperiod=14):

402

"""

403

Intraday Momentum Index

404

405

Momentum oscillator that uses intraday price movements to identify

406

overbought and oversold conditions, similar to RSI but based on

407

opening and closing price relationships.

408

409

Parameters:

410

- open: array-like, opening prices

411

- close: array-like, closing prices

412

- timeperiod: int, number of periods (default: 14)

413

414

Returns:

415

numpy.ndarray: IMI values (0-100 range)

416

"""

417

```