
“The Biggest Gold Mine in History”
That’s what NVIDIA’s CEO said investors in AI are tapping into. And market experts say it could send stocks for companies that create robots, aka physical AI, soaring on a "multi-year supertrend."
But 39k+ investors aren’t waiting for Wall Street. They're backing a private company NVIDIA hand-picked to help build the future of restaurant kitchen AI robots: Miso Robotics.
Miso’s Flippy Fry Station AI robots have now logged 200k+ hours cooking at fry stations for brands like White Castle, frying 5M+ food baskets. With NVIDIA sharpening Miso’s tech, Ecolab making a strategic investment, and a new manufacturing partnership secured, Miso’s scaling its robot production to meet this $1 trillion industry’s demand.
100k+ US fast-food locations are in need, a $4B/year revenue opportunity for Miso. Become an early-stage Miso shareholder today and unlock up to 7% bonus stock.
Invest in Miso Today
This is a paid advertisement for Miso Robotics’ Regulation A offering. Please read the offering circular at invest.misorobotics.com.
🔔 Limited-Time Holiday Deal: 20% Off Our Complete 2026 Playbook! 🔔
Level up before the year ends!
AlgoEdge Insights: 30+ Python-Powered Trading Strategies – The Complete 2026 Playbook
30+ battle-tested algorithmic trading strategies from the AlgoEdge Insights newsletter – fully coded in Python, backtested, and ready to deploy. Your full arsenal for dominating 2026 markets.
Special Promo: Use code WINTER2026 for 20% off
Valid only until March 20, 2026 — act fast!
👇 Buy Now & Save 👇
Instant access to every strategy we've shared, plus exclusive extras.
— AlgoEdge Insights Team
🔔 Flash Launch Alert: AlgoEdge Colab Vault – Your 2026 Trading Edge! 🔔
The $79 book gives you ideas on paper.
This gives you 20 ready-to-run money machines in Google Colab.
I've turned my 20 must-have, battle-tested Python strategies into fully executable Google Colab notebooks – ready to run in your browser with one click.
One-click notebooks • Real-time data • Bias-free backtests • Interactive charts • OOS tests • CSV exports • Pro metrics
Test on any ticker instantly (SPY, BTC, PLTR, TSLA, etc.).
Launch Deal (ends March 5, 2026):
$129 one-time (save $40 – regular $169 after)
Lifetime access + free 2026 updates.
Inside the Vault (20 powerhouses):
Bias-Free Cubic Poly Trend
3-State HMM Volatility Filter
MACD-RSI Momentum
Bollinger Squeeze Breakout
Supertrend ATR Rider
Ichimoku Cloud
VWAP Scalper
Donchian Breakout
Keltner Reversion
RSI Divergence
MA Ribbon Filter
Kalman Adaptive Trend
ARIMA-GARCH Vol Forecast
LSTM Predictor
Random Forest Regime Classifier
Pairs Cointegration
Monte Carlo Simulator
FinBERT Sentiment
Straddle IV Crush
Fibonacci Retracement
👇 Grab It Before Price Jumps 👇
Buy Now – $129
P.S. Run code today → test live tomorrow → outperform the book readers.
Reply “VAULT” for direct link or questions.
Premium Members – Your Full Notebook Is Ready
The complete Google Colab notebook from today’s article (with live data, full Hidden Markov Model, interactive charts, statistics, and one-click CSV export) is waiting for you.
Preview of what you’ll get:

Inside:
Automatic PLTR (or any ticker) daily data download from 2021 → today via free yfinance
Full polynomial regression demo (degrees 1–4) with R², MAE, RMSE, MAPE metrics & beautiful comparison plots
Bias-free expanding-window cubic (deg=3) regression – no lookahead bias, real walk-forward style
Clear trading signals: long when price > cubic fit and slope > 0, with entry/exit markers
Interactive-style plots: price + trend filter + green/red signals + in-position highlights
Complete backtest vs Buy & Hold: daily/ cumulative returns, 0.1% transaction costs applied
Detailed performance metrics: Total Return, CAGR, Ann. Volatility, Sharpe (rf=0), Max Drawdown
Trade statistics: number of trades, win rate, average trade return
Realistic Out-of-Sample (OOS) test on last ~10% of data + separate metrics & chart
Bonus: change one line to test any symbol (e.g. TSLA, BTC-USD, AAPL, GLD) or adjust degree/window/costs
Free readers – you already got the full breakdown and visuals in the article. Paid members – you get the actual tool.
Not upgraded yet? Fix that in 10 seconds here👇
Google Collab Notebook With Full Code Is Available In the End Of The Article Behind The Paywall 👇 (For Paid Subs Only)
1. Introduction
In this third article of our four article series on moving averages in Python, we now discuss advanced weighting techniques for moving averages. These are techniques that evolve with the market, offering insights that are both responsive and revealing.
We’ll uncover how they bring a new dimension to the act of gauging market momentum, and why they are pivotal in a trader’s toolkit. For a complete overview of the techniques discussed in this article and across other articles, please see below:
Part 1 — Fundamental Techniques: Simple Moving Average (SMA), Exponential Moving Average (EMA), Weighted Moving Average (WMA), Double Exponential Moving Average (DEMA), Triple Exponential Moving Average (TEMA), Volume Adjusted Moving Average (VAMA), Adaptive Moving Average (AMA or KAMA), Triangular Moving Average (TMA), Hull Moving Average (HMA)
Part 2 — Adaptive and Dynamic: Fractal Adaptive Moving Average (FRAMA), Zero Lag Exponential Moving Average (ZLEMA), Variable Index Dynamic Average (VIDYA), Arnaud Legoux Moving Average (ALMA), MESA Adaptive Moving Average (MAMA), Following Adaptive Moving Average (FAMA) , Adaptive Period Moving Average, Rainbow Moving Average, Wilders Moving Average, Smoothed Moving Average (SMMA)
Part 3 — Advanced Weighting: Guppy Multiple Moving Average (GMMA), Least Squares Moving Average (LSMA), Welch’s Moving Average or Modified Moving Average, Sin-weighted Moving Average, Median Moving Average, Geometric Moving Average, Elastic Volume Weighted Moving Average (eVWMA), Regularized Exponential Moving Average (REMA), Parabolic Weighted Moving Average
Part 4 — From Niche to Noteworthy: Jurik Moving Average (JMA), End Point Moving Average (EPMA), Chande Moving Average (CMA), Harmonic Moving Average, McGinley Dynamic, Anchored Moving Average, Holt-Winters Moving Average, Filtered Moving Average, Kijun Sen (Base Line)
2. Background and Python Implementation
This section explores the methodologies from both theoretical and practical standpoints. The ultimate goal is to offer a Python-based implementation to put them all to work.
Good Credit Could Save You $200,000 Over Time
Better credit means better rates on mortgages, cars, and more. Cheers Credit Builder is an affordable, AI-powered way to start — no score or hard check required. We report to all three bureaus fast. Many users see 20+ point increases in months. Cancel anytime with no penalties or hidden fees.
2.1 Guppy Multiple Moving Average (GMMA)
The Guppy Multiple Moving Average (GMMA) was developed by Daryl Guppy. The GMMA comprises two sets of exponential moving averages (EMAs).
The first set, known as the “short-term group,” captures the traders’ sentiment. The second set, termed the “long-term group,” reflects the investors’ sentiment. By analyzing the interaction and relative separation between these two groups of moving averages, traders aim to identify potential trends and their strength.
The GMMA is especially useful in determining the strength of a trend. When the short-term group of EMAs moves above the long-term group and both groups diverge, it suggests a strong upward trend. Conversely, when the short-term EMAs move below the long-term group and diverge, it indicates a strong downward trend.
Formula: The GMMA involves calculating multiple EMAs:
Short-Term Group:
EMA 3 periods
EMA 5 periods
EMA 8 periods
EMA 10 periods
EMA 12 periods
EMA 15 periods
Long-Term Group:
EMA 30 periods
EMA 35 periods
EMA 40 periods
EMA 45 periods
EMA 50 periods
EMA 60 periods
For each period, the EMA is computed using the formula:

Equation 2.1.1. Computational Formula for the Exponential Moving Average (EMA) with Smoothing Factor.
Where α is 2 / n + 1 (n = period of the EMA)
The Guppy Multiple Moving Average (GMMA) offers a dual perspective on market sentiment by mapping both short-term traders and long-term investors through separate EMA clusters.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def calculate_EMA(prices, period):
alpha = 2 / (period + 1)
EMA = [prices[0]]
for price in prices[1:]:
EMA.append((price - EMA[-1]) * alpha + EMA[-1])
return EMA
# Fetching data
ticker_symbol = "AAPL"
original_data = yf.download(ticker_symbol, start="2020-01-01", end="2024-01-01")
data = original_data.copy()
close_prices = data['Close'].tolist()
# Short-term GMMA EMAs
short_periods = [3, 5, 8, 10, 12, 15]
for period in short_periods:
data[f'EMA_{period}'] = calculate_EMA(close_prices, period)
# Long-term GMMA EMAs
long_periods = [30, 35, 40, 45, 50, 60]
for period in long_periods:
data[f'EMA_{period}'] = calculate_EMA(close_prices, period)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, original_data['Close'], label='Price', color='black')
for period in short_periods:
plt.plot(data.index, data[f'EMA_{period}'], label=f'EMA {period}')
for period in long_periods:
plt.plot(data.index, data[f'EMA_{period}'], '--', label=f'EMA {period}')
plt.title(f'Guppy Multiple Moving Average (GMMA) of {ticker_symbol}')
plt.legend()
plt.grid()
plt.show()
Figure 1. Guppy Multiple Moving Average (GMMA) Analysis of AAPL from 2020 to 2023: The chart showcases the stock price of Apple Inc. (AAPL) in black. Accompanying the price are short-term Exponential Moving Averages (EMAs) in solid lines and long-term EMAs in dashed lines. The convergence and divergence patterns of these EMAs can indicate potential trend strengths and reversals.
2.2 Least Squares Moving Average (LSMA)
The Least Squares Moving Average (LSMA) is not an “average” in the traditional sense. It is essentially a trend line produced using the least squares regression method over a defined period.
By minimizing the sum of the squares of the deviations between the data points and the line, the LSMA attempts to fit the best straight line through the data points in the given period. This makes it especially useful for spotting changes in the trend and potential turning points.
To compute the LSMA:
Define a period n.
For each data point x from 1 to n, compute its linear regression line value.
The equation for the line is given by y = mx + c, where m is the slope and c is the y-intercept.
The LSMA is essentially the computed y values for each x.
The slope m is given by:

Equation 2.2.1. Slope of the Least Squares Moving Average (LSMA): Derived using linear regression over a defined period to fit the best straight line through the data points.
And the y-intercept c is:

Equation 2.2.2. y-intercept of the LSMA: Represents the point where the regression line crosses the y-axis, aiding in trend analysis
Where:
Σxy is the sum of the product of each x value and its corresponding y value (price).
Σx is the sum of x values.
Σy is the sum of y values (prices).
Σx² is the sum of the squares of x values.
Rather than the traditional averaging method, LSMA employs the least squares regression to carve a trend line across a specified span. Its genius lies in reducing the total squared deviations between the data and this line, effectively pinpointing the optimal trend representation.
The best HR advice comes from those in the trenches. That’s what this is: real-world HR insights delivered in a newsletter from Hebba Youssef, a Chief People Officer who’s been there. Practical, real strategies with a dash of humor. Because HR shouldn’t be thankless—and you shouldn’t be alone in it.
This quality allows traders to readily identify shifts in market trends and pivotal turning junctures. As a tool, LSMA is particularly valued when traders aim to dissect and understand nuanced trend evolutions over time.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def calculate_LSMA(prices, period):
n = period
x = np.array(range(1, n+1))
LSMA = []
for i in range(len(prices) - period + 1):
y = prices[i:i+period]
m = (n*np.sum(x*y) - np.sum(x)*np.sum(y)) / (n*np.sum(x**2) - np.sum(x)**2)
c = (np.sum(y) - m*np.sum(x)) / n
LSMA.append(m * n + c) # The projected value at the end of the period
# Padding the beginning with NaNs for alignment
LSMA = [np.nan] * (period-1) + LSMA
return LSMA
# Fetching data
ticker_symbol = "NVDA"
data = yf.download(ticker_symbol, start="2020-01-01", end="2024-01-01")
close_prices = data['Close'].tolist()
# Calculate LSMA
lsma_period = 28
data['LSMA'] = calculate_LSMA(close_prices, lsma_period)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label='Price', color='black')
plt.plot(data.index, data['LSMA'], label=f'LSMA {lsma_period}', color='blue')
plt.title(f'Least Squares Moving Average (LSMA) of {ticker_symbol} (n = {lsma_period})')
plt.legend()
plt.grid()
plt.show()
Figure 2. Least Squares Moving Average (LSMA) Analysis of NVIDIA Corp. (NVDA) from 2020 to 2023: This chart displays NVIDIA Corp.’s (NVDA) stock price in black against its 28-period LSMA in blue. The LSMA, calculated using a linear regression approach, projects the value at the end of each period, offering insights into the stock’s potential future movement based on past trends.
2.3 Welch’s Moving Average or Modified Moving Average
The Modified Moving Average (MMA), also known as Welch’s Moving Average, is a variation of the simple moving average. Instead of computing the average of all the data in its window, it calculates the average based on the previous average and the current data point.
This recursive approach gives more weight to the recent data. It provides a smoother response to price changes than a simple moving average (SMA) and is less lagging.
To calculate the MMA for a period n:

Equation 2.3.1. the Modified Moving Average (MMA): A recursive adaptation of the simple moving average, emphasizing more recent data for smoother, less lagging price response.
Where:
MMAt is the Modified Moving Average at time t.
Price_t is the price at time t.
n is the period of the MMA.
While the Modified Moving Average (MMA) shares foundational principles with the SMA, its computational distinction lies in its recursive nature. Instead of merely averaging the data within a specified window, the MMA derives its value by melding the prior average with the current data point.
This design inherently amplifies the significance of newer data, enabling a swift yet smooth adaptation to price variations. For traders, this suggests that the MMA may offer a more immediate sense of the market’s trajectory compared to the traditional SMA.
import yfinance as yf
import matplotlib.pyplot as plt
def calculate_MMA(prices, period):
MMA = [sum(prices[:period]) / period] # Start with the SMA for the first value
for t in range(period, len(prices)):
MMA.append((prices[t] + (period - 1) * MMA[-1]) / period)
return [None]*(period-1) + MMA # Pad the beginning with None for alignment with N-1 values
# Fetching data
ticker_symbol = "BA"
data = yf.download(ticker_symbol, start="2020-01-01", end="2024-01-01")
close_prices = data['Close'].tolist()
# Calculate MMA
mma_period = 14
data['MMA'] = calculate_MMA(close_prices, mma_period)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label='Price', color='black')
plt.plot(data.index, data['MMA'], label=f'MMA {mma_period}', color='blue')
plt.title(f'Welch\'s Moving Average (Modified Moving Average) of {ticker_symbol} (n = {mma_period})')
plt.legend()
plt.grid()
plt.show()
Figure 3. Welch’s Moving Average (Modified Moving Average) Analysis of The Boeing Company (BA) from 2020 to 2023: This visualization contrasts The Boeing Company’s (BA) stock price (depicted in black) with its 14-period Modified Moving Average (blue line). The MMA, a variation of the Exponential Moving Average, provides a smoother representation of price trends, which can be useful for traders and analysts in spotting potential trend directions.
2.4 Sin-weighted Moving Average
The Sin-weighted Moving Average (SinWMA) is a type of moving average that applies sine-weighted factors to the data points within its window. The weights are designed to increase from the beginning to the middle of the window and then decrease from the middle to the end, forming a bell-shaped curve.
The logic behind SinWMA is to give more importance to the central data points of the window and reduce the weight of the extremes, thereby emphasizing the middle data points.
To calculate the SinWMA for a period n:

Equation 2.4.1. Sin-weighted Moving Average (SinWMA): Utilizes sine-weighted factors, emphasizing the central data points in its window with a bell-shaped curve weighting.
Price_t−n+i is the price at the time t−n+i.
wi is the weight of the ith data point in the window and is calculated as:

Equation 2.4.2. Weight in SinWMA: Determines the weight for each data point based on its position in the window, forming a bell-shaped curve emphasis.
The Sin-weighted Moving Average’s main advantage is its emphasis on central data points, making it responsive to price actions while still being smoother than simple moving averages. This unique weighting strategy forms a bell-shaped curve, stressing the middle data while attenuating the importance of the peripheral points.
In practical terms, the SinWMA captures a balance, responding aptly to price fluctuations yet maintaining a degree of smoothness that guards against erratic market noise. For traders who value a nuanced perspective that pivots around central trends, the SinWMA can be an insightful tool.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def calculate_SinWMA(prices, period):
weights = [np.sin(np.pi * i / (period + 1)) for i in range(1, period+1)]
sum_weights = sum(weights)
normalized_weights = [w/sum_weights for w in weights]
SinWMA = []
for t in range(period - 1, len(prices)):
window = prices[t-period+1:t+1]
SinWMA.append(sum([normalized_weights[i] * window[i] for i in range(period)]))
return [None]*(period-1) + SinWMA # Pad the beginning with None for alignment
# Fetching data
ticker_symbol = "ADS.DE"
data = yf.download(ticker_symbol, start="2020-01-01", end="2024-01-01")
close_prices = data['Close'].tolist()
# Calculate SinWMA
sinwma_period = 21
data['SinWMA'] = calculate_SinWMA(close_prices, sinwma_period)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label=f'{ticker_symbol} Price', color='black')
plt.plot(data.index, data['SinWMA'], label=f'SinWMA {sinwma_period}', color='green')
plt.title(f'Sin-weighted Moving Average of {ticker_symbol} (n = {sinwma_period})')
plt.legend()
plt.grid()
plt.show()
Figure 4. Sin-weighted Moving Average Analysis of Adidas AG (ADS.DE) from 2020 to 2023: This graph showcases the stock price of Adidas AG (ADS.DE) from 2020 to 2023, delineated by a black line. Superimposed on this is the Sin-weighted Moving Average (SinWMA) with a period of 14, shown in green. The SinWMA, by employing sinusoidal weighting factors, potentially offers a unique perspective on price trends, helping traders identify potential market shifts
2.5 Median Moving Average
The Median Moving Average (MedMA) is not based on the arithmetic mean like the Simple Moving Average (SMA) but instead uses the median of the price over the lookback period. Medians are often considered more robust than averages because they are less sensitive to extreme outliers. Thus, the MedMA might be less susceptible to extreme price spikes or dips compared to the SMA.
Given a series of prices, for each point in time:
Take the last n prices including the current one.
Sort them.
If n is odd, the median is the middle number.
If n is even, the median is the average of the two middle numbers.
The Median Moving Average (MedMA) prioritizes the median price, shielding it from extreme price variations and offering a clearer perspective of genuine market trends.
This makes MedMA a preferred tool in volatile markets, ensuring that sudden price anomalies don’t skew its representation. In essence, MedMA blends accuracy with stability, granting traders insights that are both clear and robust against transient market shocks.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def calculate_MedMA(prices, window):
medians = []
for i in range(len(prices)):
if i < window - 1:
medians.append(np.nan)
else:
median = np.median(prices[i - window + 1: i + 1])
medians.append(median)
return medians
# Fetching data
ticker_symbol = "EURUSD=X"
data = yf.download(ticker_symbol, start="2020-01-01", end="2023-01-01")
# Calculate MedMA
medma_period = 20
data['MedMA'] = calculate_MedMA(data['Close'], medma_period)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label='Price', color='black')
plt.plot(data.index, data['MedMA'], label=f'MedMA {medma_period}', color='blue')
plt.title(f'Median Moving Average (MedMA) of {ticker_symbol} (n = {medma_period})')
plt.legend()
plt.grid()
plt.show()
Figure 5. Median Moving Average (MedMA) of EURUSD (2020–2023): The MedMA is calculated by taking the median of the previous n days' closing exchange rate. For this data, we're using a 20-day window. In the plot, the exchange rate (black) is displayed alongside its MedMA (blue). The MedMA helps to smoothen outliers and provides a clearer representation of the price's general movement, compared to simple moving averages which take the mean.
2.6 Geometric Moving Average
The Geometric Moving Average is a type of moving average that applies a geometric progression formula. It multiplies the values, rather than adding them up, as done in an arithmetic moving average.
Due to its multiplicative nature, GMA is especially sensitive to price movements and is less affected by outliers, making it more reactive to price changes compared to the arithmetic mean-based averages.
Given a series of prices p1, p2,…, pn for n periods:

Equation 2.6.1. Formula for the Geometric Moving Average (GMA): This formula emphasizes the multiplicative characteristics of the GMA, setting it apart from traditional arithmetic moving averages.
By emphasizing product over summation, the GMA captures compounded price effects, resulting in a heightened responsiveness to consecutive price variations. This ensures that even subtle market shifts are promptly reflected.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def calculate_GMA(prices, window):
gm_avg = []
for i in range(len(prices)):
if i < window - 1:
gm_avg.append(np.nan)
else:
product = np.prod(prices[i - window + 1: i + 1])
gma_value = product ** (1/window)
gm_avg.append(gma_value)
return gm_avg
# Fetching data
ticker_symbol = "PG"
data = yf.download(ticker_symbol, start="2020-01-01", end="2024-01-01")
# Calculate GMA
gma_period = 20
data['GMA'] = calculate_GMA(data['Close'], gma_period)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label='Price', color='black')
plt.plot(data.index, data['GMA'], label=f'GMA {gma_period}', color='green')
plt.title(f'Geometric Moving Average (GMA) of {ticker_symbol} (n = {gma_period})')
plt.legend()
plt.grid()
plt.show()
Figure 6. Geometric Moving Average (GMA) of PG (2020–2023): The GMA is calculated by taking the nth root of the product of the previous n days’ closing prices. For this data, we’re using a 20-day window. In the plot, Procter & Gamble’s stock price (black) is displayed alongside its GMA (green). The GMA offers a multiplicative view of returns over the specified window and provides a unique perspective on the price’s general movement, compared to other moving averages.
2.7 Elastic Volume Weighted Moving Average (eVWMA)
The Elastic Volume Weighted Moving Average (eVWMA) is an advanced variant of the traditional Volume Weighted Moving Average (VWMA). Unlike the VWMA which emphasizes the volume by giving more importance to the days with larger volumes, the eVWMA goes a step further.
It factors in an exponential component, ensuring that not only does the position of the price within the moving average window matter, but also its relative volume. This means prices paired with higher volumes will be exponentially more influential in the eVWMA than in the VWMA.
The formula for eVWMA can be represented as:

Equation 2.6.1. Elastic Volume Weighted Moving Average (eVWMA) formula illustrating the relationship between price, volume, and an exponential factor over a specified window.
Where:
Pt = Price at time t
Vt = Volume at time t
λ = Exponential factor typically calculated as 2 / (window + 1)
The inclusion of the exponential factor in the eVWMA gives it a unique edge. More recent prices, especially when associated with high trading volumes, play a considerably more influential role in shaping its value. This characteristic makes the eVWMA a vital instrument in a trader’s toolkit. Traders can harness its heightened sensitivity to discern potential momentum shifts in the market more promptly than with other averages.
When the eVWMA exhibits significant deviations from traditional price averages, it can signal underlying market sentiment changes, often spurred by volume-backed movements. This quick adaptability to volume surges or sudden drops makes eVWMA indispensable for those looking to gauge real-time market dynamics and capitalize on emerging opportunities.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def calculate_eVWMA(prices, volumes, window):
evwma_values = []
for i in range(len(prices)):
if i < window:
evwma_values.append(np.nan)
else:
price_subset = prices[i-window+1:i+1]
volume_subset = volumes[i-window+1:i+1]
numerator = sum([p * v for p, v in zip(price_subset, volume_subset)])
denominator = sum(volume_subset)
evwma = numerator / denominator
evwma_values.append(evwma)
return evwma_values
# Fetching data
ticker_symbol = "SIE.DE"
data = yf.download(ticker_symbol, start="2020-01-01", end="2023-01-01")
# Calculate eVWMA
evwma_period = 20
data['eVWMA'] = calculate_eVWMA(data['Close'], data['Volume'], evwma_period)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label='Price', color='black')
plt.plot(data.index, data['eVWMA'], label=f'eVWMA {evwma_period}', color='blue')
plt.title(f'Elastic Volume Weighted Moving Average (eVWMA) of {ticker_symbol}')
plt.legend()
plt.grid()
plt.show()
Figure 7. Elastic Volume Weighted Moving Average (eVWMA) of SIE.DE (2020–2023): Using a 20-day window, the eVWMA emphasizes volume’s impact on price. The chart contrasts Siemens AG’s stock price (black) with its eVWMA (blue), offering insight into volume-driven price changes.
2. 8 Regularized Exponential Moving Average (REMA)
The REMA aims to overcome some limitations of the standard EMA by adding a regularization term that penalizes extreme values in the time series, making the moving average smoother. Regularization is a concept borrowed from machine learning and statistics, where it’s used to prevent overfitting by adding some form of penalty to the loss function.
The formula for REMA can be expressed as:

Equation 2.8.1. Equation for the Regularized Exponential Moving Average (REMA): Integrating a regularization penalty to refine the standard EMA, this formula uses X(t) as the current price, REMA(t−1) for the previous REMA value, α as the smoothing factor, and λ as the regularization factor.
Where:
X(t) = Current price at time t
REMA(t−1) = Regularized EMA value of the previous period
α = Smoothing factor (same as in the EMA)
λ = Regularization factor
Penalty = Regularization term (often the second derivative)
The regularization penalty in this simple example will be the second derivative, approximated using finite differences. This means that the penalty becomes large when the curve changes its direction (i.e., when there’s a curvature).
REMA marries traditional technical analysis with machine learning principles, offering a nuanced interpretation of price dynamics. By introducing a regularization term, the REMA mitigates abrupt price spikes, producing a smoother moving average. This not only captures the asset’s prevailing trend but also ensures resilience against fleeting market anomalies.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def REMA(prices, alpha=0.1, lambda_=0.1):
rema = [prices[0]]
penalty = 0
for t in range(1, len(prices)):
second_derivative = prices[t] - 2 * prices[t-1] + prices[t-2] if t-2 >= 0 else 0
penalty = lambda_ * second_derivative
current_rema = alpha * prices[t] + (1 - alpha) * rema[-1] - penalty
rema.append(current_rema)
return rema
# Fetching data
ticker_symbol = "ASML.AS"
data = yf.download(ticker_symbol, start="2020-01-01", end="2024-01-01")
alpha_value = 0.1
lambda_value = 0.1
data['REMA'] = REMA(data['Close'], alpha=alpha_value, lambda_=lambda_value)
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label='Price', color='black')
plt.plot(data.index, data['REMA'], label='REMA', color='red')
plt.title(f'Regularized Exponential Moving Average (REMA) of {ticker_symbol}')
plt.legend()
plt.grid()
plt.show()
Figure 8. REMA of ASML.AS (2020–2024): The REMA (red) introduces a penalty based on price curvature to an exponential moving average. For ASML’s stock (black), the REMA adjusts to sudden price changes more rapidly, aiming to reduce overshoot in volatile moments.
2.9 Parabolic Weighted Moving Average
The Parabolic Weighted Moving Average (PWMA) is a type of moving average that places greater weight on the most recent data points, and the weights decrease in a parabolic manner for earlier periods. This emphasizes recent prices more than older prices, potentially allowing for faster response to price changes compared to other types of moving averages.

Equation 2.9.1. Formula for the Parabolic Weighted Moving Average (PWMA): Designed to emphasize recent data points, the PWMA uses a unique weighting mechanism where weights decrease parabolically for preceding periods
Where:
P(t−i) is the price at time t−i.
w(i) is the parabolic weight for the price at time t−i. This is calculated as (n−i)² where n is the period of the moving average.
PWMA introduces an innovative approach to weighing price data, prioritizing recency with a rapidly decreasing emphasis on past prices. The parabolic decrease in weights ensures that the PWMA is particularly attuned to the latest market shifts, positioning it to detect emerging trends faster than conventional moving averages.
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
def parabolic_weighted_moving_average(prices, n=14):
weights = np.array([(n-i)**2 for i in range(n)])
return np.convolve(prices, weights/weights.sum(), mode='valid')
# Fetching data
ticker_symbol = "T"
data = yf.download(ticker_symbol, start="2020-01-01", end="2023-01-01")
pwma_period = 14
pwma_values = parabolic_weighted_moving_average(data['Close'].values, pwma_period)
data['PWMA'] = np.concatenate([np.array([np.nan]*(pwma_period-1)), pwma_values])
# Plotting
plt.figure(figsize=(20,7))
plt.plot(data.index, data['Close'], label='Price', color='black')
plt.plot(data.index, data['PWMA'], label='Parabolic Weighted MA', color='red')
plt.title(f'Parabolic Weighted Moving Average (PWMA) of {ticker_symbol}')
plt.legend()
plt.grid()
plt.show()
Figure 9. PWMA of T (2020–2023): The PWMA (red) uses a parabolic weighting scheme, giving more emphasis to recent prices in the calculation. Plotted against AT&T’s closing price (black), this method offers a distinct perspective on price trends by weighing recent data more heavily.
3. Applications & Insights
Delving into advanced weighting, we come across a multitude of adaptive moving averages each designed with specific advantages for different market scenarios.
The Guppy Multiple Moving Average (GMMA) provides insights into short-term and long-term group consensus, offering a comprehensive view of market sentiment. The Least Squares Moving Average (LSMA), rooted in linear regression, aims to minimize the distance between price points and the moving average line, offering a smoother representation.
Welch’s Moving Average or the Modified Moving Average focuses on a modified data set, making it more responsive to recent data. Sin-weighted Moving Average applies a sinusoidal weighting, capturing a distinct type of market rhythm.
While Median Moving Average centers on the median of the price data, reducing the impact of price spikes, the Geometric Moving Average multiplies rather than adds price data, emphasizing compounding effects. Elastic Volume Weighted Moving Average (eVWMA) offers a unique volume-based sensitivity, making it incredibly responsive during significant volume changes.
Regularized Exponential Moving Average (REMA) combats the problem of overfitting, ensuring the moving average isn’t too closely tailored to past data. Lastly, Parabolic Weighted Moving Average introduces a parabolic factor, giving greater importance to recent prices.
4. Concluding Thoughts
Advanced weighting techniques in moving averages are indispensable for traders striving for precision and depth in their analyses. By utilizing these sophisticated weightings, traders can:
Precisely discern emerging trends and impending reversals.
Sidestep potential pitfalls from deceptive signals.
Architect robust strategies to mitigate market risks.
At its core, embracing advanced weighting mechanisms is about honing a keener sense of the market’s pulse, ensuring each trading decision is both informed and insightful.
Subscribe to our premium content to read the rest.
Become a paying subscriber to get access to this post and other subscriber-only content.
Upgrade








