mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-24 05:28:05 +00:00
- Updated BBWN, BBWP, CCV, CV, CVI, EWMA, GKV, HLV, HV, Jvolty, JVOLTYN, MASSI, NATR, RSV, RV, RVI, TR, UI, VOV, VR, YZV indicators with documentation links. - Added documentation links for Aberration, Acceleration Bands, Andrews' Pitchfork, Adaptive Price Zone, ATR Bands, Bollinger Bands, Center of Gravity, Donchian Channels, Decay Min-Max Channel, Detrended Synthetic Price, EACP, EBSW, HOMOD, Jurik Volatility Bands, Keltner Channel, MA Envelope, Min-Max Channel, Price Channel, Regression Channels, Standard Deviation Channel, Stoller Average Range Channel, Super Trend Bands, Ultimate Bands, Ultimate Channel, VWAP Bands, and VWAP with Standard Deviation Bands.
29 lines
798 B
Plaintext
29 lines
798 B
Plaintext
// The MIT License (MIT)
|
|
// © mihakralj
|
|
//@version=6
|
|
indicator("Momentum (MOM)", "MOM", overlay=false)
|
|
|
|
//@function Calculates price momentum over specified period
|
|
//@param src Source series to calculate momentum for
|
|
//@param len Lookback period for momentum calculation
|
|
//@returns Momentum value measuring rate of price change
|
|
mom(series float src, simple int len) =>
|
|
if len <= 0
|
|
runtime.error("Length must be greater than 0")
|
|
float result = 0.0
|
|
if not na(src) and not na(src[len])
|
|
result := src - src[len]
|
|
result
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
// Inputs
|
|
i_length = input.int(10, "Length", minval=1)
|
|
i_source = input.source(close, "Source")
|
|
|
|
// Calculation
|
|
mom_value = mom(i_source, i_length)
|
|
|
|
// Plot
|
|
plot(mom_value, "MOM", color=color.yellow, linewidth=2)
|