On this page
Overview
In this tutorial I translate Wilder's momentum concept, a 40-plus-year-old idea from J. Welles Wilder's 1978 book New Concepts in Technical Trading Systems, into a ThinkOrSwim indicator. Its momentum factor compares today's close with the close 2 bars ago, and the indicator plots a dot at the close whenever Wilder's long or short rule is met.
Then I turn the same few lines of thinkScript into a scan that finds the bar where momentum shifts from one side to the other. One of our Volatility Box members found the concept, researched it and built the spreadsheet this tutorial is based on. It's a good first project if you want to turn an idea from a trading book into code.
Key Takeaways
- Wilder's momentum factor is today's close minus the close 2 bars ago. J. Welles Wilder described it in his 1978 book New Concepts in Technical Trading Systems.
- Wilder's long rule: today's momentum factor is higher than either of the previous 2. The short rule is stricter: lower than both.
- Our free ThinkOrSwim indicator plots a dot at the close on every bar that meets a rule, at line weight 5, with inputs to hide the dots and to show each bar's momentum factor in a bubble.
- The scan finds the shift: a long reading today after a bar without one. In the video it cut the S&P 100 to 5 bullish shifts, including Pfizer, and the bearish version returned 56.
- The download has the indicator as a .ts file and the scan as one ThinkOrSwim shared link, with a bullish and a bearish line to toggle.
What Is Wilder's Momentum Concept?
Wilder's momentum concept is a way to measure momentum through the acceleration and deceleration of price. J. Welles Wilder Jr. described it in New Concepts in Technical Trading Systems, published in 1978. The same book introduced the RSI, the Average True Range, the Parabolic SAR and the Directional Movement Index.
The concept centers on one number, the momentum factor: today's close minus the close 2 days ago. When the momentum factor keeps rising, price is accelerating. When it shrinks, price is slowing down, even if it's still going up. Wilder's long and short rules compare today's momentum factor with the previous 2 to catch those shifts.
The concept is on page 52 or 53 of the book, depending on your copy. The book takes it further into a full system with targets and stops. In the video I stay at a high level and build the momentum factor and its 2 rules.

If you trade Wilder's other indicators, our Dynamic RSI, Parabolic SAR and multi time frame DMI tutorials build on them in ThinkOrSwim.
Wilder's 10-Day Momentum Factor Example
Wilder's example uses 10 days of closing prices for one ticker. The momentum factor starts on day 3, the first day with a close 2 days back to compare with.
| Day | Close | Momentum factor | Reading in the example |
|---|---|---|---|
| 1 | 49.25 | None yet | |
| 2 | 49.75 | None yet | |
| 3 | 50.25 | +1.00 | |
| 4 | 50.75 | +1.00 | |
| 5 | 51.10 | +0.85 | First short |
| 6 | 50.75 | 0 | |
| 7 | 51.00 | -0.10 | |
| 8 | 49.75 | -1.00 | |
| 9 | 49.25 | -1.75 | |
| 10 | 49.50 | -0.25 | Long |
Day 3 closed at 50.25, $1 above day 1's 49.25, so its momentum factor is +1.00. Day 4 is 50.75 minus 49.75, also +1.00. On day 5 price rose again to 51.10, but the momentum factor fell to +0.85, and by day 6 it was 0.
After momentum slowed, price chopped sideways and then sold off. That's the purpose of the momentum factor: to get ahead of these shifts and ride the ebb and flow of price.
Wilder's Long and Short Rules
Wilder's momentum concept goes long on the close when today's momentum factor is higher than either of the previous 2 days' momentum factors. It goes short when today's momentum factor is lower than both of them, so the short rule is the stricter one.
| Rule | Today's momentum factor must be | thinkScript test |
|---|---|---|
| Long | Higher than yesterday's or the day before's | momentumFactor > momentumFactor[1] or momentumFactor > momentumFactor[2] |
| Short | Lower than yesterday's and the day before's | momentumFactor < momentumFactor[1] and momentumFactor < momentumFactor[2] |
In the example, day 5 is the first short: its +0.85 is below both +1.00 readings from days 3 and 4. Day 10 is a long: its -0.25 is above both -1.75 and -1.00, though it only needed to beat one of them.

The shift from long to short, or short to long, is what gives you a heads up. A bar that isn't long is at or below both previous readings, so nearly every bar is either long or short. Only a tie with the lower of the previous 2 readings leaves a bar with neither.
How to Build Wilder's Momentum Concept in ThinkOrSwim
Wilder's momentum concept indicator is built from scratch in a new study. These are the steps I follow in the video:
- Open a chart, click the Studies icon and click Create. I used an S&P 500 chart, and the time frame doesn't matter yet. Give the study a name; the download's file is TI_WildersMomentumConceptSTUDY.ts.
- Define the momentum factor and check it with a temporary yellow chart bubble on every bar.
- Add the long and short rules as plots that return 1 or 0, and check them in a lower pane.
- Switch both plots to return the close or Double.NaN, paint them as points, and move the study to the upper pane.
- Add the showMomentumFactor input so you can turn the dots off, and set the dot weight. I started at 3 and went up to 5, the maximum.
- Turn the test bubble into an option with showMomentumFactorBubbles, colored cyan or pink by the long rule.
The finished study is in the download. Our guide on how to import a study into ThinkOrSwim shows how to add it.
How the Code Works
Wilder's momentum concept takes fewer than 15 lines of thinkScript. Here they are in the order I wrote them.
Step 1: The Momentum Factor
The momentum factor is the close minus the close 2 bars back. The [2] after close references the bar before yesterday's bar.
This step’s code is free with an account. Create one or sign in.
In the video, one bar's bubble read 14.35: a 243.15 close minus 228.80 two bars earlier. The next bar read 23.84, above 14.35 and above -17.56, so it met the long rule twice over.
Step 2: The Long Dots
The long plot applies Wilder's long rule and returns the close when it's met, so the dot sits on the closing price. Double.NaN tells ThinkOrSwim to plot nothing on the other bars.
This step’s code is free with an account. Create one or sign in.
I first plotted the rule as 1 and 0. That suits boolean arrows, but a 0 still shows on the chart. The close and Double.NaN give a cleaner look and let you paint the plot as points.
Step 3: The Short Dots
This step’s code is free with an account. Create one or sign in.
The short plot uses and where the long plot uses or, so today's momentum factor has to be below both previous readings. Weight 5 is the largest dot ThinkOrSwim draws. I found 3 a little small.
Step 4: The Inputs and the Bubble
This step’s code is free with an account. Create one or sign in.
showMomentumFactor sits inside both plot conditions, so setting it to no hides every dot. showMomentumFactorBubbles prints each bar's momentum factor at the close, cyan when the long rule is met and pink when it isn't.
Wilder's Momentum Concept Settings
Wilder's momentum concept indicator has 2 inputs. The other settings sit in the code.
| Setting | Default | What it does |
|---|---|---|
| showMomentumFactor | yes | Shows or hides the long and short dots |
| showMomentumFactorBubbles | no | Prints each bar's momentum factor in a cyan or pink bubble |
| Lookback (in the code) | 2 bars | The close[2] in the momentum factor |
| Dot weight (in the code) | 5 | Size of the dots, the largest setting |
| Painting strategy (in the code) | Points | Draws dots at the close instead of a line |
The code doesn't set dot colors, so the plots use ThinkOrSwim's default colors. On my chart in the video the long dots were cyan and the short dots pink. You can change them in the study's settings, and you can plot the dots somewhere other than the close if you prefer.
How to Turn It Into a Momentum Shift Scan
The Wilder's momentum concept scan looks for the bar where momentum shifts: a long reading today after a bar without one. Here's how I built it from the indicator code:
- Copy the indicator code. In the Scan tab, click Add filter, choose Study, pick Custom at the bottom of the dropdown and open the thinkScript Editor tab. Paste the code.
- Delete the chart bubble, the 2 inputs and the showMomentumFactor checks inside the conditions.
- Change close and Double.NaN back to 1 and 0, and delete the painting strategy and line weight lines.
- A scan filter takes exactly one plot, so change both entries to defs and add a signal plot: a long reading today and none on the previous bar.
Here's the scan code written out from the video. It isn't copied from the download, which has the original scan as a ThinkOrSwim shared link, so its line numbers differ from the download's note.
This step’s code is free with an account. Create one or sign in.
To scan for bearish shifts, comment out the first signal line and uncomment the second. The note in the download says the same about the shared scan.
What the Scan Found in the Video
The Wilder's momentum concept scan ran on the S&P 100 in the video. A plain long-reading scan returned 41 stocks, including Apple, which had positive momentum but no shift. The shift version cut the list to 5.
- Pfizer, bullish shift. The momentum factor at Friday's close was 0.26: the 37.13 close minus the 36.87 close 2 bars earlier. That's above both previous readings, -0.13 and 0.06. The 0.06 bar was a short reading, below both 0.38 and 0.07.
- Ford, bearish shift. The bearish version returned 56 stocks. Ford's momentum factor at Friday's close was 0.16, below both 0.41 and 0.32.

These results come from the day I recorded, so your list will be different.
How I Read the Momentum Dots
Wilder's momentum dots are a heads-up about momentum, and the shift is the part I watch. In one stretch in the video, long dots ran for several bars, a shift warned that momentum was slowing, price pulled back a little, and then momentum rallied again in the direction of the overall trend.
I treat a shift as a read on momentum rather than an entry on its own. Wilder's book builds the momentum factor into a full system with stops and targets, and his stop uses the average true range. Decide where your stop goes before you act on a dot, and size the position so a stop-out costs a small, fixed share of your account.
For the ATR side, our average true range scans work with ATR in ThinkOrSwim. The rate of change indicator is another way to measure how far price has moved over a set number of bars.
Going Further: Wilder's Trend Balance Point System
Wilder's Trend Balance Point System is on page 53 of the book. Wilder gives a formula for the close needed today for the long rule or the short rule to trigger, so you know the level before the bar closes. The book also covers a procedure, stops and targets.
You can work out a similar level from the 2 rules yourself. This arithmetic isn't in the video, and it isn't Wilder's page 53 formula: today's reading is long if the close ends above the close 2 bars back plus the lower of the previous 2 momentum factors, and short if it ends below that level.
On day 5 of the example, that level is 50.25 plus 1.00, or 51.25. The 51.10 close came in below it, which is why day 5 was a short.
Coding these extra pieces is a good next project if you want to practice thinkScript. ThinkOrSwim already has the true range in its studies, which you can use for the stop. More free scans to learn from are on our scans page.
Wilder's momentum on real charts
Drawn from real daily bars with the code on this page, through Oct 20, 2026. The momentum factor is the close minus the close 2 bars earlier. The long rule: today's factor is higher than either of the 2 before it. The short rule: lower than both. The dots sit at the close; I drew long dots cyan and short dots pink, the colors of the study's bubbles. The scan looks for the shift: a long reading after a bar without one. I picked the most recent shift on 44 well-known stocks and ETFs that closed higher 5 days later, and the most recent that did not.
XOM, Oct 13, 2026: a shift that followed through

On Oct 13, 2026, XOM closed at $174.13, a momentum factor of +5.19 against +3.60 and +4.89 on the 2 bars before. Five trading days later it closed at $177.86, +2.1%.
NFLX, Oct 13, 2026: one that did not

NFLX shifted to long on Oct 13, 2026 at $70.48 with a factor of +0.18, and closed at $68.69 five days later, -2.5%.
By the numbers
Daily bars for 30 well-known stocks and 14 ETFs, Jul 17, 2024 to Oct 20, 2026: 5,358 shifts to long, which did about as well as any day. Because the long rule only needs to beat one of the 2 earlier readings, it covers most bars, and shifts come often. The factor reads acceleration, not direction: a stock can fall and still meet the long rule when it falls less than before.
Full thinkScript code
Create a free account or sign in to copy all 18 lines and download the file.
Download
Download Wilder's Momentum Concept indicator and scan for ThinkOrSwim. The download is a .zip with 2 files: TI_WildersMomentumConceptSTUDY.ts, the indicator (the same code as the Code tab on this page), and a .txt with one ThinkOrSwim shared link for the scan. The scan has a bullish and a bearish line: uncomment the one you want. If you haven't imported a study or shared item before, here's how to import into your ThinkOrSwim platform.
Questions
What is Wilder's momentum concept?
Wilder's momentum concept measures momentum through the acceleration and deceleration of price. J. Welles Wilder described it in his 1978 book New Concepts in Technical Trading Systems. It uses a momentum factor, today's close minus the close 2 days ago, and compares today's reading with the previous 2 to find long and short readings and the shifts between them.
How do you calculate Wilder's momentum factor?
Subtract the close from 2 days ago from today's close. In Wilder's example, day 3 closed at 50.25 and day 1 at 49.25, so day 3's momentum factor is +1.00. In thinkScript it's one line, def momentumFactor = close - close[2];, and on an intraday chart it compares bars instead of days.
What are Wilder's long and short momentum rules?
Go long on the close when today's momentum factor is higher than either of the previous 2 days' momentum factors. Go short when it's lower than both of them, which makes the short rule stricter. In Wilder's 10-day example, the first short comes on day 5 and the long on day 10.
Why does nearly every bar show a dot?
A bar that fails the long rule has a momentum factor at or below both previous readings, and if it's below both, it meets the short rule. Only a tie with the lower of the 2 previous readings leaves a bar with no dot. That's why the scan looks for the shift from one side to the other instead of the dots themselves.
How do I add Wilder's Momentum Concept indicator to ThinkOrSwim?
Download the zip from this page and import TI_WildersMomentumConceptSTUDY.ts, or copy the code from the Code tab into a new study with Studies, then Create. The dots plot at the closing price on the price chart. Set showMomentumFactor to no to hide them, or showMomentumFactorBubbles to yes to see each bar's momentum factor.
How do I scan for Wilder's momentum shifts in ThinkOrSwim?
Open the shared scan link from the download, or paste the indicator code into a custom study filter. Remove the bubble, the inputs and the formatting, return 1 and 0, and keep one plot: a long reading today with none on the previous bar. In the video this cut the S&P 100 to 5 stocks.
What do the cyan and pink bubbles mean?
The bubbles print each bar's momentum factor at the close. A bubble is cyan when that bar meets Wilder's long rule, a momentum factor above either of the previous 2, and pink when it doesn't. They're off by default. Turn them on with the showMomentumFactorBubbles input.
What is Wilder's Trend Balance Point System?
The Trend Balance Point System is on page 53 of Wilder's 1978 book. Wilder gives a formula for the close needed today for the long or short momentum rule to trigger, and the book adds a procedure, stops based on the average true range, and targets. The video and the download stop at the momentum factor and its 2 rules.
Get each new indicator by email
One email on Sundays with the week's new tool and its code. A free account also unlocks every .txt download.
No credit card. Unsubscribe anytime.
Fair Value Gap
False Breakout Scanner
Heiken Ashi Trend



Stock Volatility Box
Futures Volatility Box
ORB Setups
Squeeze Setups
Multi-Time Frame DMI
DMI Power Move Scans
Reversion to 50-Day Moving Average
Covered Call Calculator
Cash-Secured Put Calculator
Cumulative TICK