Moving Average Clouds
Easy spot trends and trend reversals with the Moving Average Clouds, and learn crucial concepts along the way.
Introduction
The Moving Average Clouds Indicator is a practical tool that visualizes trend strength and direction by combining two moving averages and shading the area between them. This shading creates a “cloud” that allows traders to quickly gauge market momentum and potential reversals.
In this tutorial, we’ll walk you through the process of building this indicator in ThinkOrSwim using thinkScript code.
By the end, you’ll know how to adjust line colors based on trend conditions, customize the moving averages, and integrate the cloud for an easy-to-read indicator (that you built yourself!).
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
Understanding the Moving Average Clouds Indicator
Moving Average Clouds is based on two moving averages: a faster-moving one and a slower-moving one. The space between these averages is shaded, creating the cloud effect. When the fast moving average crosses above the slow one, this bullish trend is indicated by a green cloud. Conversely, a crossover below the slow moving average signals a bearish trend with a red cloud.
This indicator offers more than just moving averages—it provides an intuitive way to visualize market trends. Ideal for both novice and experienced traders, the Moving Average Clouds Indicator is versatile enough for short-term trading and long-term trend following.
Benefits of Using Moving Average Clouds
With the cloud-based approach, you can quickly see:
- Trend Direction: Green clouds suggest bullish trends, while red clouds point to bearish ones.
- Potential Entry and Exit Points: Crossovers often signal when to enter or exit trades. A fast MA crossing above the slow one could indicate a buying opportunity, while a cross below might suggest a sell.
- Noise Reduction: The cloud shading helps filter out minor fluctuations, allowing for clearer trend signals.
For those looking to streamline their trading, this indicator can simplify the decision-making process by highlighting key market patterns.
Building the Moving Average Clouds Indicator in thinkScript
Step 1: Setting Up Your Workspace
To get started, open the ThinkOrSwim platform, click on the Studies icon, and select Create. This opens the thinkScript editor. Name your study something like “Moving Average Clouds” and delete any pre-existing code so you’re starting fresh.
Step 2: Define Key Inputs
Define the primary variables for your indicator, including the lengths of the moving averages, moving average types, and the price data to use. Input this code:
input fastMALength = 8;
input fastMAType = AverageType.EXPONENTIAL;
input slowMALength = 21;
input slowMAType = AverageType.EXPONENTIAL;
input price = close;
These variables give the user control over the fast and slow moving averages, allowing them to modify the length, type, and price setting used in the calculations. You can adjust these settings later to align with your preferred trading strategy.
Step 3: Plot the Moving Averages
With the moving average parameters set, you’re now ready to calculate and plot the fast and slow moving averages:
plot fastMA = MovingAverage(fastMAType, price, fastMALength);
plot slowMA = MovingAverage(slowMAType, price, slowMALength);
This code adds the two moving averages directly to the chart, showing how the fast (8-period) and slow (21-period) lines interact. As market prices fluctuate, these averages provide a dynamic way to track trend shifts.
Step 4: Add Color for Visual Clarity
To make these moving averages more informative, add color that reflects trend direction. If the fast MA is above the slow MA, a bullish trend is indicated by a green line. If it’s below, the line turns red, signaling a bearish trend.
fastMA.assignValueColor(if fastMA > slowMA then Color.GREEN else Color.RED);
slowMA.assignValueColor(if fastMA > slowMA then Color.GREEN else Color.RED);
This color coding helps you quickly see shifts in trend direction, and also distinguish bullish from bearish movements.
Step 5: Create the Cloud Effect
The real highlight of the Moving Average Clouds Indicator is the shaded cloud between the two lines. This cloud is green during bullish trends and red during bearish trends, providing an instant visual cue on the market’s current trend.
AddCloud(fastMA, slowMA, Color.GREEN, Color.RED);
The AddCloud
function uses three inputs—the fast and slow moving averages, and the cloud colors. When the fast MA is above the slow MA, the cloud turns green. When it’s below, the cloud shifts to red.
Customization Options for Enhanced Flexibility
1. Adjusting Moving Average Lengths
One of the best features of this indicator is that you can adjust the lengths of the moving averages to suit different trading styles:
- Short-term trading: Use smaller values, like 3 and 8, for fast reactions to price changes. This approach is useful for day traders looking to capture quick trends.
- Long-term investing: For a broader perspective, try values like 50 and 200. These larger values highlight long-term trends, ideal for swing traders or investors who prefer to hold positions over several weeks or months.
2. Experimenting with Different Moving Average Types
ThinkOrSwim provides several moving average types, each with unique characteristics:
- Simple Moving Averages (SMA): Equal weighting to all data points.
- Exponential Moving Averages (EMA): More weight on recent data, making it more sensitive to price changes.
- Weighted Moving Averages (WMA): Applies different weights to data points, emphasizing recent prices.
- Hull Moving Averages (HMA): Reduces lag, providing faster signals.
By testing different types, you can tailor the indicator to align with specific market conditions and trading strategies.
3. Customizing Price Inputs
The Moving Average Clouds Indicator can be further refined by adjusting the type of price data it uses. ThinkOrSwim offers several options, including close, open, high, and low prices. Using different price points can affect how the moving averages track market action, allowing you to adapt the indicator to your preferred analysis method.
Practical Applications in Trading
Once the Moving Average Clouds Indicator is set up, it offers a range of practical uses for trading:
Identifying Trend Changes: Crossovers between the fast and slow moving averages often signal shifts in trend direction. A fast MA crossing above the slow MA may signal a buying opportunity, while a cross below could indicate it’s time to sell.
Tracking Trend Strength: When the fast and slow MAs diverge, it usually indicates a strong trend. For instance, if the fast MA continues to stay above the slow MA, it reflects sustained bullish momentum.
Utilizing Cloud Colors: The cloud color gives an immediate view of trend conditions. Green clouds suggest an uptrend, while red clouds indicate a downtrend. Use the cloud color as a confirmation signal for entering or exiting trades.
Spotting Reversals: The Moving Average Clouds Indicator can also help spot trend reversals. For example, after a sustained uptrend, a crossover of the fast MA below the slow MA could indicate the start of a bearish reversal, and vice versa.
Conclusion
The Moving Average Clouds Indicator offers you a quick, and efficient way to visualize market trends, reduce noise, and identify key trading opportunities.
With customization options for length, type, and price input, the tool can be morphed to fit many trading strategies.
Hope you found this thinkScript coding tutorial useful, and as always, good luck trading!
downloads
Download the Moving Average Clouds Indicator for ThinkorSwim.
The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.
Download Indicator
Download the Moving Average Clouds Indicator for ThinkorSwim.
The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.