Cumulative Advance Decline Trading System

Build an introductory trading system using the Advance Decline line, by taking a basic indicator and extracting patterns and signals.

11 mins
Beginner-Friendly
youtube-video-thumbnail
Table of Contents
    Add a header to begin generating the table of contents
    Table of Contents
      Add a header to begin generating the table of contents

      Introduction

      The Cumulative Advance Decline Indicator tracks the cumulative difference between advancing and declining stocks, giving you a perspective on market breadth.

      • When advances outpace declines, the indicator rises, signaling bullish sentiment.
      • Conversely, when declines dominate, it drops, suggesting bearish momentum.

      You can use this indicator to gauge the overall market direction and spot potential turning points by examining divergence between the cumulative line and price action.

      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

      Why the Cumulative Advance Decline is Useful in a Trading System

      With the Cumulative Advance Decline, you’re able to spot broader market trends, beyond the movements of individual stocks. For example, when a market rally is accompanied by a rising cumulative line, it strengthens the bullish case. Conversely, if the cumulative line is falling during a rally, it might signal weakness and a potential reversal. By integrating the Cumulative Advance Decline into your trading system, you’re able to monitor both individual tickers and the overall market to better time entries and exits.

      Building a Cumulative Advance Decline Trading System

      Step 1: Setting Up Your Workspace

      To get started, open ThinkOrSwim and navigate to the Studies section. Click on ‘Create’ to start a new custom study. Name this study something meaningful, like Cumulative Advance Decline System. For this tutorial, we’ll work with six market symbols, but feel free to adjust the number to suit your needs.

      Step 2: Input Your Symbols

      In this example, we’re focusing on six market symbols. Use the input function to define each symbol as shown below. This setup allows you to easily adjust symbols in the future directly from the study settings.

      
      input symbol_1 = "/NQ:XCME";
      input symbol_2 = "/ES:XCME";
      input symbol_3 = "/YM:XCME";
      input symbol_4 = "/RTY:XCME";
      input symbol_5 = "/ZB:XCBT";
      input symbol_6 = "/MNQ:XCME";
      

      Step 3: Defining the Advance/Decline Logic

      Now, we’ll determine whether each symbol is advancing or declining based on the previous close. Use the following code for each symbol to identify if it has increased or decreased in value compared to the previous bar.

      
      def symbol1 = close(symbol_1);
      def symbol11 = close(symbol_1)[1];
      def symbol1a = symbol1 > symbol11;
      def symbol1b = symbol1 < symbol11;
      

      Repeat this for each symbol, changing the variable names accordingly. For example, replace symbol1 with symbol2 and so on.

      Step 4: Calculating the Cumulative Advance Decline Line

      With the advance/decline status defined for each symbol, you can now calculate the Cumulative Advance Decline Line by summing up the individual results. The following code calculates the line and plots it:

      
      plot advDecLine = TotalSum((symbol1a - symbol1b) + (symbol2a - symbol2b) + (symbol3a - symbol3b) + (symbol4a - symbol4b) + (symbol5a - symbol5b) + (symbol6a - symbol6b));
      AddChartBubble(GetYYYYMMDD() >= anchorDate, 0, advDecLine, Color.Yellow);
      

      Step 5: Adding a Moving Average for Trend Identification

      Adding a moving average to your cumulative line can help you identify the broader trend. Use the following code to calculate and plot a 50-period moving average of the advance-decline line:

      
      plot advDecLineAvg = Average(advDecLine, 50);
      

      Step 6: Adding Buy and Sell Signals

      To make this a complete trading system, let’s add buy and sell signals based on crossovers of the Cumulative Advance Decline Line and its moving average, with CCI confirmation. A bullish signal occurs when the line crosses above the average with CCI above 100, while a bearish signal appears when it crosses below with CCI under -100. Here’s the code:

      
      plot bearishCrossOverSignal = if advDecLine < advDecLineAvg and advDecLine[1] >= advDecLineAvg and CCI() <= -100 then advDecLineAvg else Double.NaN; plot bullishCrossOverSignal = if advDecLine > advDecLineAvg and advDecLine[1] <= advDecLineAvg and CCI() >= 100 then advDecLineAvg else Double.NaN;
      bearishCrossOverSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
      bullishCrossOverSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
      

      Step 7: Styling the Arrows

      To make the signals easier to spot, you can increase the arrow weight. Here’s how:

      
      bearishCrossOverSignal.SetLineWeight(3);
      bullishCrossOverSignal.SetLineWeight(3);
      

      Now, your chart should display up and down arrows on the Cumulative Advance Decline Line whenever a bullish or bearish crossover occurs.

      Conclusion

      You’ve now built a powerful Cumulative Advance Decline Trading System that leverages the market breadth to provide you with trade signals. Feel free to experiment with different tickers, adjust the moving average period, or add other conditions to enhance the indicator further.

      As you trade with this system, remember to observe how well it tracks major market shifts and how it performs under different market conditions.

      With these insights, you can fine-tune the system to suit your trading style even more.

      Hope you found this tutorial helpful. Thanks for watching, and as always, good luck trading!

      downloads

      Download the Advance Decline Trading System for ThinkorSwim.

      The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.

      Download Indicator

      Download the Advance Decline Trading System for ThinkorSwim.

      The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.

      Have your own idea?

      Let us help you turn your trading strategy into a powerful indicator, scan and backtester.