Market Pulse
A powerful trend trading tool, to identify what the current market condition is and how to profit from it
Welcome to the seventh episode of “How to Thinkscript”.
We are TOSIndicators.com, home of the Volatility Box, the most robust ThinkOrSwim indicator based on statistical models built for large institutions and hedge funds.
In today’s video, we’re going to show you how to build a tool that lets you identify which one of the four market stages we are currently in.
The Market Pulse Indicator is an invaluable tool for traders seeking to understand the current market environment. By identifying distinct phases – Acceleration, Accumulation, Deceleration, and Distribution – this indicator will help you pick the right trading strategy, based on the current market condition.
In this guide, we’ll cover what the Market Pulse Indicator is, explain each of the four market stages, and provide practical advice on how to use it.
Following that, we’ll dive into a step-by-step ThinkScript tutorial, where you’ll learn how to code the indicator from scratch.
Here’s everything that we will build in this tutorial:
- Market Pulse Indicator
- Utility Labels for ETFs AND 10-Day $PCALL Moving Avg Ratio and $TRIN
- Scan to Identify Accumulation to Acceleration
- Scan to Identify Distribution to Deceleration
Volatility Box Invite
We are TOS Indicators.com, home of the Volatility Box.
The Volatility Box is our secret tool, to help us consistently profit from the market place. We’re a small team, and we spend hours every day, after the market close, doing nothing but studying thousands of data points to keep improving and perfecting the Volatility Box price ranges.
We have two different Volatility Boxes - a Futures Volatility Box and a Stock Volatility Box.
Futures Volatility Box - Trade Major Markets With an Edge
Designed For: Futures, Micro-Futures and Index Market Traders
Supported Models: Hourly Volatility Box models
Supported Markets: 10 Major Futures Markets
The Futures Volatility Box comes with:
- 5 Volatility Models for each market
- Support for 10 Futures Markets (/ES, /NQ, /YM, /RTY, /CL, /GC, /SI, /ZB, /HG, /NG)
- Video Setup Guide
- Trade Plan
- Access to all members-only resources, including Squeeze Course
Learn More About the Futures Volatility Box
Trade futures and micro futures with a consistent volatility edge
Stock Volatility Box - Powerful Web Based Volatility Platform
Designed For: Stock and Options Traders
Supported Models: Hourly and Daily Volatility Box models
Supported Markets: 10,000+ Stocks and ETFs (new markets added frequently)
A Stock Volatility Box membership includes access to:
- Live Scanner - A powerful scanner we've built from scratch, to scan 10,000 symbols every 2 seconds for new volatility breaches
- Dashboard - A quick and easy way to view daily volatility model levels online
- Short Interest Scanner - Short interest, Squeeze, and EMA data to find short squeezes
- Squeeze Course - All of our proprietary squeeze tools, including robust backtesters
- All Members Only Indicators - We don't nickel and dime you. Everything really is included.
- And much more!
Learn More About the Stock Volatility Box
Trade stocks and options with a consistent volatility edge
What is the Market Pulse Indicator?
The Market Pulse Indicator tracks price momentum across four primary market stages:
- Acceleration: A strong, trending movement where prices rapidly increase.
- Accumulation: A quieter phase of gradual price gains, often following a downtrend.
- Deceleration: The trend shows signs of losing momentum, typically indicating a potential reversal.
- Distribution: A period of sideways movement, where traders consolidate gains and prepare for the next trend.
This indicator employs moving averages to detect and categorize each stage, making it a straightforward tool for visually recognizing shifts in market conditions.
Understanding the Four Market Stages
The Four Market Stages are: Aaccumulation, Distribution, Acceleration, Deceleration.
- Acceleration
During this phase, the market experiences significant bullish momentum. This stage often signals a breakout where price action indicates an upward trend. Traders in this stage may prefer aggressive strategies, such as buying out-of-the-money calls, anticipating continued upward momentum. - Accumulation
The accumulation phase is characterized by a consolidation pattern. Traders accumulate assets at these levels, preparing for the next upward move. Strategies are typically conservative here, with traders entering long positions or initiating spreads, reflecting an expected upward bias. - Deceleration
In the deceleration stage, prices begin to slow down. This indicates a bearish momentum, and traders may start to pivot toward protective strategies, such as selling off positions or purchasing puts. - Distribution
The final stage is distribution, where price action stalls, often leading to a range-bound movement. During this phase, both bullish and bearish trades become challenging, with strategies like iron condors or spreads being more appropriate.
We build a market pulse indicator, that uses a Variable Moving Average along with Volume Weighted Moving Averages to try and identify which one of the four market stages we’re in.
Here’s how the final product looks:
Market Pulse for TradingView (Free):
As of March 2022, we have continued our expansion of our indicator set into the TradingView platform.
Our Market Pulse indicator is now available for the TradingView platform, and is 100% free, for you to start using in your trading.
You can add the indicator to your charts by:
- Visit our TradingView profile page
- Navigate to the “Scripts” tab
- Find the Market Pulse indicator and click to open
- Scroll down and click the blue “Add to favorite indicators” button
As of 3/22/22, we currently have all 5 Futures Volatility Box models, the Edge Signals indicator, and the Market Pulse available for the TradingView platform.
Market Pulse thinkScript Tutorial
Now, let’s dive into coding the Market Pulse Indicator using ThinkScript. Follow along to add this powerful tool to your ThinkOrSwim workspace.
Step 1: Setting Up the Script
- Open the ThinkOrSwim platform, and go to the Studies tab.
- Click on Create to open a new thinkScript editor.
Start by defining a few basic input variables and initializing moving averages that will calculate the market’s condition based on volume and price.
input ChartBubblesOn = no; input price = close; input length = 10;
Step 2: Building the Volume-Weighted Moving Averages
The Volume-Weighted Moving Average (VWMA) considers volume when calculating the moving average, which provides a weighted average price reflective of trading activity.
def vwma8 = Sum(volume * close, 8) / Sum(volume, 8); def vwma21 = Sum(volume * close, 21) / Sum(volume, 21); def vwma34 = Sum(volume * close, 34) / Sum(volume, 34);
These moving averages are essential for determining bullish and bearish market conditions. Here, we’re creating three VWMA lines for the 8, 21, and 34 periods.
Step 3: Identifying Bullish, Bearish, and Distribution Phases
Using the VWMA lines, we’ll now define the market phases based on the relative position of these moving averages.
def bullish = if vwma8 > vwma21 and vwma21 > vwma34 then 1 else 0; def bearish = if vwma8 < vwma21 and vwma21 < vwma34 then 1 else 0; def distribution = if !bullish and !bearish then 1 else 0;
In this section, we assign the different market conditions for each phase, which allows the indicator to differentiate between trending and range-bound periods.
Step 4: Adding Labels for the Market Stage
To make it easy to see which phase we are currently in, let’s add labels with distinct colors for each market phase.
AddLabel(yes, if bullish and close >= VMA then "Stage: Acceleration" else if bearish and close <= VMA then "Stage: Deceleration" else if close >= VMA then "Stage: Accumulation" else "Stage: Distribution", if bullish and close >= VMA then Color.GREEN else if bearish and close <= VMA then Color.RED else if close >= VMA then Color.YELLOW else Color.ORANGE);
Step 5: Plotting the Variable Moving Average (VMA)
The VMA combines volume and price for a comprehensive moving average that reacts to market changes.
def VMA = compoundValue("visible data" = coeff * price + (if IsNaN(VMA[1]) then 0 else VMA[1]) * (1 - coeff), "historical data" = price); VMA.SetDefaultColor(GetColor(0));
Step 6: Chart Bubbles for Entry Points
Adding chart bubbles provides visual cues on the chart when the market shifts phases. The bubbles can signal entry points for acceleration and deceleration phases, ideal for traders seeking confirmation of market changes.
def accumulationToAcceleration = if (bullish and close >= VMA) then 1 else 0; AddChartBubble(ChartBubblesOn and accumulationToAcceleration and !accumulationToAcceleration[1], close, "Entering Acceleration", Color.GREEN);def distributionToDeceleration = if (bearish and close <= VMA) then 1 else 0; AddChartBubble(ChartBubblesOn and distributionToDeceleration and !distributionToDeceleration[1], close, "Entering Deceleration", Color.RED);
Step 7: Customizing the Indicator’s Colors and Labels
Assign colors based on each market stage to make the chart more visually intuitive. The Market Pulse Indicator provides color-coded visualizations to help traders quickly assess which phase the market is currently in.
VMA.AssignValueColor(if bearish and close <= VMA then Color.RED else if bullish and close >= VMA then Color.GREEN else Color.GRAY);
Conclusion
The Market Pulse Indicator is a versatile tool for trend traders. It allows you to quickly create and adapt strategies to the current market stage, without fussing around with moving averages or variability.
If you followed along with the thinkScript coding tutorial, hopefully you learned a thing or two about the different types of moving averages used and thinkScript logic available to create powerful trend indicators for ThinkOrSwim (in just a few lines of code).
You can also customize the Market Pulse Indicator to visualize trends on your charts. Whether you’re looking for aggressive entries in acceleration phases or aiming to avoid choppiness during distribution, the Market Pulse Indicator can help guide your trades with precision.
Thank you for following along with this tutorial, and as always, good luck trading!
downloads
Download the Market Pulse and Utility Labels indicators for ThinkorSwim.
The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.
Download Indicator
Download the Market Pulse and Utility Labels indicators for ThinkorSwim.
The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.