BWMA: a moving average you can tune for lag and smoothness
Ever looked at your moving averages and thought, “The SMA is too slow, but the EMA or HMA is too jittery”? A Useful MA Weighting Function For Controlling Lag & Smoothness is built for exactly that problem: it’s a moving average that lets you dial in the trade-off between lag and smoothness with just two numbers. On the chart it shows up as BWMA, so that’s what we’ll call it here.
Every moving average gets its personality from one thing: how much weight it gives each of the last N bars when it averages them. An SMA weights every bar equally; a WMA gives more weight to newer bars. BWMA draws that weighting as a curve with a single peak, and lets you shift where the peak sits and how sharp it is using -Lag and +Lag. At the defaults the peak sits right in the middle, which gives you a very smooth, low-noise line.
BWMA colors itself by the line’s own momentum
One smooth line that turns green while the uptrend runs, fades through yellow to orange as it stalls, and drifts toward red as the decline continues.
Vowars DE ver.3.24.1
The other thing that stands out is the color. BWMA runs through a 200-step gradient from red to orange, yellow and green. As Figure 1 shows, it turns green while an uptrend keeps going; as in Figure 2, it fades from yellow to orange once the move stalls, and it drifts toward red as a decline drags on. There are no buy or sell signals, but between the slope and the color you can read the current trend at a glance, which makes it easy to check the market bias.
I ran it on several timeframes, and on every one of them it drew a single smooth curve that doesn’t get thrown around by individual candles.

Why does the line change color?
Start by understanding how the color is decided. The key point: the color is driven by the BWMA line itself, not by price.
How the line color is decided
BWMA’s color comes from how the line itself moves, not from price directly.
Vowars DE ver.3.24.1
BWMA calculates an RSI on the line it has just drawn, and uses that value to pick one of 200 colors. The RSI period is the same as length, so 50 bars by default. As Figure 2 shows, an RSI below 50 gives red to orange, and above 50 the line moves through yellow into green.
Because the line is smooth, its RSI doesn’t whip around either. One big candle barely changes the color; the green only deepens once the line has been rising for a while. In other words, the color isn’t telling you whether the current bar is strong or weak — it’s telling you how long the line has been pointing up or down. Read it that way and you won’t misread it.
While the line is pointing up, it stays green even if the rally slows down. In the charts I tested, the color never slipped back toward yellow while the line was still rising. The shift from green to yellow starts only after the line tops out and begins to turn down. Treat the color as confirmation of a change in direction, and read it together with the slope of the line.
What happens when you change -Lag and +Lag?
These two settings are the key to getting the most out of BWMA. As the names suggest, -Lag pushes the line toward less lag and +Lag toward more. Drawing where the weight is concentrated within the last 50 bars makes the difference easy to see.
How -Lag and +Lag reshape the weights
Each curve shows how much weight each of the last 50 bars gets. The right edge is the current bar.
Vowars DE ver.3.24.1
The default -Lag 3 / +Lag 3 puts the peak in the middle, with almost no weight at either end, as in Figure 1. Raise -Lag and the peak moves toward the newer bars, as in Figure 2; raise +Lag and it moves toward the older bars, as in Figure 3. Raise both by the same amount and the peak stays in the middle but gets narrower and sharper.
The dotted line in each panel is the center of the weights, a rough guide to how many bars the line lags on average. It sits about (length − 1) × +Lag ÷ (-Lag + +Lag) bars back. At the defaults that’s 49 × 3 ÷ 6, roughly 24.5 bars; with -Lag 6 / +Lag 2 it’s about 12 bars.
Side by side on the same price action
The numbers are hard to picture on their own, so here are three settings applied to the same price action. Watch how many bars it takes for the line to top out after price peaks.
How the -Lag / +Lag mix changes the way the line follows price
Same price action, three BWMAs with different weight shapes. Top to bottom: default, newer bars weighted, older bars weighted.
Vowars DE ver.3.24.1
With the defaults in Figure 1, the line topped out 27 bars after the high; with -Lag 6 / +Lag 2 in Figure 2, it took 15 bars. Just as the center-of-weight math predicts, the more weight on newer bars, the sooner the line turns. With a larger +Lag in Figure 3, the line kept rising for 42 bars and turned into a big, slow wave of its own.
The bar counts don’t land exactly on the center-of-weight value because the shape of the move shifts where the line tops out. The order never changes, though: more -Lag means faster, more +Lag means slower. For everyday use, the basic rule is to keep -Lag equal to or a bit higher than +Lag. Setting +Lag higher is really for when you want to ignore short-term noise and only see the big swings.
Flat weights give you an SMA, a ramp gives you a WMA
Here’s the fun part: with the right settings, BWMA turns into the moving averages you already know. At -Lag 1 / +Lag 1 the weights go completely flat, and at -Lag 2 / +Lag 1 they ramp up in a straight line toward the newest bar. When I overlaid TradingView’s built-in SMA and WMA, the lines matched perfectly.
With the right settings it becomes an SMA or a WMA
Flatten the BWMA weights and you get an SMA; make them a straight ramp toward the newest bar and you get a WMA. The blue lines are TradingView’s built-in SMA and WMA.
Vowars DE ver.3.24.1
Figure 1 is identical to an SMA 50. Figure 2 matches a WMA, but the match is WMA 49, not WMA 50. At -Lag 2 / +Lag 1 the oldest bar ends up with exactly zero weight, so only 49 bars actually count. If you’re fine-tuning against a WMA, keep that one-bar difference in mind.
If the SMA and WMA are just two of its possible settings, BWMA can also build any shape in between or beyond them. A practical approach is to start from a plain SMA and nudge -Lag up step by step until the line follows price the way you like.
length sets smoothness and lag at the same time
length is the number of bars in the average. Where -Lag and +Lag set the shape of the peak, length sets how wide it is.
How length changes smoothness and lag
-Lag and +Lag stay at their default of 3; only length changes.
Vowars DE ver.3.24.1
When -Lag and +Lag are equal, the lag is roughly (length − 1) ÷ 2 bars: about 10 bars at length 20, about 25 at the default 50, and about 50 at 100. In the chart, Figure 1 topped out 8 bars after the high, Figure 2 26 bars after, and Figure 3 57 bars after, close to those estimates.
What’s easy to miss is that length is also the period of the RSI that sets the color. Drop length to 20 and the line doesn’t just get faster — the color flips more often too. That’s why the length 20 panel cycles through green, orange and red so frequently. Raise length and both the line and the color change more slowly.
Settings and suggested setups by goal
There are only four inputs in the settings dialog. -Lag and +Lag accept values from 1 to 10.
| Setting | Default | Suggested | Effect |
|---|---|---|---|
| length | 50 | 50 (20–30 for short-term, 80–100 for the bigger trend) | Number of bars in the average. Higher values make the line smoother but add lag. The same value is used as the period of the RSI that sets the color |
| -Lag | 3 | 3–6 | Higher values shift the weight peak toward newer bars and reduce lag. Range: 1–10 |
| +Lag | 3 | 2–3 | Higher values shift the weight peak toward older bars and add lag. Above 1, the live bar gets zero weight. Range: 1–10 |
| src | close | close | Price used for the average. Can be switched to other sources such as hl2 |
The easiest way to tune it is to set the overall speed with length first, then fine-tune how closely it tracks price with -Lag. If you change -Lag and +Lag at the same time, it’s hard to tell what actually changed.
| If you want to… | Starting point | Why |
|---|---|---|
| Start with the standard look | length 50, -Lag 3, +Lag 3 | Same ~25-bar lag as an SMA 50, but smoother because the ends carry little weight |
| Turn faster at tops and bottoms | -Lag 5–6, +Lag 2 | The center of weight moves to about 12–14 bars back, so it tracks price faster at the same length |
| Catch shorter swings for day trading | length 20–30, -Lag 3, +Lag 3 | Lag drops to roughly 10–15 bars, and the color flips faster too |
| See only the big trend for swing trading | length 80–100, -Lag 3, +Lag 3 | Line and color both move slowly, making the big daily and weekly waves easy to follow |
| Reproduce an SMA or WMA | -Lag 1 / +Lag 1, or -Lag 2 / +Lag 1 | The first matches an SMA; the second matches a WMA one bar shorter |
Raise both to the same value, like -Lag 10 / +Lag 10, and the lag stays around 25 bars while the peak just gets narrower. The bars at the edges matter even less, so the line becomes rounder and smoother. It’s an option when you want less noise without adding lag.
How to use it on the chart
BWMA won’t tell you when to buy or sell. What it does is show the direction and strength of the trend in a single line. After using it for a while, these three ways of reading it turned out to be the most useful.
1 Use color and slope to set your bias
Green and rising means an uptrend; red or orange and falling means a downtrend. Yellow to orange with a nearly flat line means there’s no clear direction. Use this first to decide whether you’re looking for longs, looking for shorts, or sitting out for the day.
2 A pullback into the green line is a dip-buy candidate
When price pulls back to the BWMA in the middle of an uptrend, that’s a spot to think about buying the dip. Because the line is so smooth, it’s easy to see whether price has really reached it.
Pullbacks into the green line
Mid-uptrend, price dips into the green BWMA and bounces without breaking far below it.
Vowars DE ver.3.24.1
In both Figure 1 and Figure 2, price dipped close to the line and bounced. Meanwhile, as Figure 3 shows, the line stayed green and pointed up. The more of these line up — green line, rising slope — the stronger the case for treating the dip as a pullback. If price instead breaks well below the line and the color starts drifting toward yellow, be careful: it may be a trend change, not a dip.
3 Treat a color change as a cue to plan your exit
If you’re long and the line tops out and starts shifting from green to yellow, the uptrend is taking a breather. Whether or not you close right away, it’s a good cue to trail your stop higher or take partial profits. Keep in mind that at the defaults the line lags by about 25 bars, so price can give back a good chunk of the move while you wait for the color to change. If you want to react earlier, try the ALMA combo covered later.

Which timeframes and markets suit it best?
BWMA looks the same on any timeframe, but with roughly 25 bars of lag at the defaults, I found it shines most for day trading and swing trading on the 1-hour to daily charts. It still draws a clean curve on the 1-minute or 5-minute chart, but 25 bars is 25 minutes on the 1-minute and about two hours on the 5-minute — too slow for scalping decisions. On lower timeframes, dropping length to around 20 is the realistic choice.
In terms of market conditions, it does best in clear trends. When a rally or sell-off keeps going, the line turns green or red and the direction is easy to read. That works for trend-prone assets like Bitcoin, and the same reading applies to gold, stock indices and major FX pairs like USD/JPY. In a choppy, range-bound market, the line flattens out and the color sits somewhere between yellow and orange. That itself is the information — “no direction” — so don’t force a trade off it.
On higher timeframes like the weekly, a single line traces the big multi-year waves up and down. It also works well for long-term investors who want to check whether they’re still in an up-wave or have rolled into a down-wave.

Why doesn’t the line move on the live bar?
BWMA is a moving average calculated only from past bars, and values on confirmed bars never get rewritten later. It does not repaint.
At the defaults there’s also an unusual quirk. When +Lag is greater than 1, the newest bar gets exactly zero weight. If you look at the weight curves, you can see the tail drop all the way to zero at the “current bar” on the right edge. As a result, no matter how far price moves on the live bar, BWMA’s value and color for that bar stay the same. The previous bar’s close only enters the calculation once that bar closes and the next one opens.
A line that doesn’t flicker is easier on the eyes, but it also means a sudden spike won’t show up in the line at all until the next bar. When a bar is moving hard right now, base your decision on the candles, not the line. Setting +Lag to 1 puts weight on the current bar, so the line will move on the live bar as well.
BWMA has no built-in alert conditions. That said, in TradingView’s alert dialog you can pick price and BWMA as the condition and set it to Crossing, so you can still get notified when price crosses above or below the line.
Pair it with ALMA and the lag difference becomes obvious
With its peak in the middle, the default BWMA takes around 25 bars to turn after a top. That smoothness comes at a price: it will always be late on sharp reversals. So I overlaid the Arnaud Legoux Moving Average (ALMA), which also lets you shape its weights, using the same period. By default, ALMA puts its weight peak on the newer bars.
Same 50 bars, but ALMA turns first
BWMA (default) overlaid with a 50-period ALMA (blue). Their weight peaks sit in different places, so they react differently at the top.
Vowars DE ver.3.24.1
As Figure 1 shows, the blue ALMA topped out 12 bars after the high, then crossed down through BWMA in Figure 2. BWMA only tops out later, in Figure 3, and it’s still green at that point.
This pairing splits the work: BWMA for the big picture, ALMA for what’s happening right now. When ALMA crosses below BWMA, treat it as an early warning that the trend may be turning; when BWMA shifts from yellow to orange and points down, treat it as confirmation. Both are looking at the same 50 bars, so the only difference is where the weight sits. It’s also a great way to see how much the weighting shape changes a moving average’s character. ALMA is one of TradingView’s built-in indicators — just change its Length to 50 to try it.
Two more that look like a good fit. If you want help telling trends from ranges, the Trend Strength Index measures how closely closes line up in a straight line over time. When BWMA’s color is stuck around yellow, it lets you confirm with a number whether there really is no direction. If you want an exit reference, add Volatility Stop, which uses ATR to set its distance and trails price — it gives you the stop-loss line that BWMA doesn’t provide.
Where BWMA shines and what to watch for
Where it shines
- Just two inputs, -Lag and +Lag, give fine control over the lag vs. smoothness trade-off
- The defaults keep the same lag as an SMA but produce a smoother line
- It can reproduce an SMA or WMA, so you can start tuning from a line you already know
- The 200-step color shows trend direction and how long it has lasted at a glance
- Confirmed bars never change, and at the defaults the line doesn’t flicker on the live bar
What to watch for
- About 25 bars of lag at the defaults, so it turns late on sharp reversals
- The color comes from the line’s RSI, so it changes after sudden price moves, not with them
- In ranging markets the line goes flat and says little about direction
- Changing length also changes how fast the color flips
Things to know before you use it
BWMA is a moving average. A touch of the line doesn’t guarantee a bounce, and a green line doesn’t guarantee price will rise. On historical charts the pullbacks may seem to stop neatly at the line, but that’s hindsight; in real time, price can slice through it and keep falling.
Also remember that the same number of bars means a different amount of time on each timeframe. Twenty-five bars is about a month on the daily and about a day on the 1-hour. Keeping in mind how many bars it lags on your timeframe makes it easier to decide whether to wait for the line to turn or act earlier on other evidence. Don’t base entries or exits on BWMA alone — combine it with support and resistance and other indicators.
For traders who want a moving average built their way
ImageUnlike fixed-shape averages like the SMA or WMA, BWMA lets you choose where its weight peak sits and what shape it takes. Even at the defaults it works as a trend baseline that’s smoother than an SMA; raise -Lag to make it more responsive, and use length to set its overall speed. Add the 200-color gradient on top, and you can read trend direction and staying power from a single line — that’s its biggest appeal.
If you’ve ever wished your usual moving average were “a little faster” or “a little calmer,” you’ll get the most out of tweaking BWMA’s settings. A good place to start is putting it next to an SMA or EMA and comparing the lines.








