OPEN-SOURCE SCRIPT
Shift Share - 5-Model Production Matrix

The 5-Model Stock Breakdown: A Beginner Guide
Imagine you are looking at a single stock—let us call it SuperEco Corp—and its price just jumped up by 10 percent over the last few weeks.
If you ask a regular person why it went up, they might say, "Because it is a good stock!" But a seasoned investor knows that a stock price does not move in a vacuum. It is being pulled and pushed by different invisible forces.
This guide explains how our tracking tool uses a method called Regression to break down that 10 percent jump and reveal exactly who was responsible for the move. You do not need a background in math, economics, or statistics to understand how it works.
1. The Three Invisible Forces
Our model assumes that a stock price movement depends on three major factors:
The Market (The Rising Tide): This is the entire stock market (like the S&P 500). When the overall economy is booming, optimism runs high, and almost every stock gets lifted. If the market goes up sharply, our stock will likely get dragged up with it, purely by association.
The Sector (The Industry Wave): This is the specific neighborhood the stock lives in (such as Technology, Energy, or Healthcare). If electric vehicles are suddenly booming, all EV stocks will rise together, even the poorly managed ones, because money is pouring into that specific industry bucket.
The Stock Itself (Its Unique Engine): This is the company own secret sauce. It includes their unique products, their management team, their earnings reports, and their breakthroughs. This is what belongs only to this stock and no one else.
What is Regression?
Think of a stock total return like a baked cake. You know the cake tastes sweet (the stock went up 10 percent), but you do not know how many cups of sugar, flour, or butter went into it.
Regression is a tool that acts like a laboratory test for that cake. It analyzes the final product, compares it to how the broader market and sector were moving at the same time, and extracts the exact recipe. It tells you: "Of this 10 percent move, 5 percent was caused by the market, 3 percent was caused by the sector, and 2 percent was the stock unique engine."
2. Leftover Mystery: The Statistical Error
No matter how smart a math model is, it can never perfectly predict human behavior or random events. When we add up what the Market and the Sector should have done to the stock, it rarely perfectly matches the actual final price.
The piece that is left over is called the Statistical Error (or Noise Floor).
Think of it like static on an old television set, or the background chatter in a crowded restaurant. It represents random daily market zig-zags, algorithmic trading glitches, or minor noise that has no real structural meaning. If our model is working correctly, this error row should be very small, meaning our factors successfully explained the vast majority of the price movement.
3. The 5 Steps of Understanding: Our Dropdown Models
To help you see how these forces interact, our indicator lets you switch between 5 different structural models using a simple settings dropdown menu. Think of this like changing lenses on a camera to see the data in different ways:
Model 1: No Variables (The Blindfold View)
This model assumes that external factors do not exist. It completely ignores the market and the sector. The stock price is treated as moving entirely on its own, plus some random mystery noise. This establishes a baseline to see what the stock looks like when you isolate it from macro events.
Model 2: Market Only (The Macro Lens)
This model assumes that only the big picture matters. It watches how the stock moves in relation to the main stock market index. It tells you if your stock is just a mirror of the broader economy. If the market explains almost all of the move, your stock is behaving like an index fund.
Model 3: Sector Only (The Neighborhood Watch)
This model ignores the broader market and looks strictly at the stock specific industry group. This helps you see if the stock is simply riding an industry-wide trend or hype cycle, completely independent of whether the rest of the world markets are up or down.
Model 4: Both Market and Sector (The Parallel View)
This model looks at both forces simultaneously, but treats them as completely independent. It assumes they run side-by-side like two trains on parallel tracks. This isolates how much of the stock price was swept up by the macro economy versus how much was driven by its specific industry peer group.
Model 5: Full Interactive Model (The Chemistry Lab)
In the real world, forces do not just run on parallel tracks—they collide and alter each other. This model introduces a special Interaction Term. When a roaring market slams into a hyper-growth sector, they create a compounding synergy that accelerates or dampens stock prices. This is the most realistic model, stripping away all shared group behavior to isolate the stock true standalone engine.
4. Reading Your Screen: The Output Matrix Table Explained
When you load the script on your chart, it generates a clean summary table in your indicator pane. Here is how to interpret the four columns:
Column 1: Source Factor
This lists the different forces we are tracking: Market Component, Sector Component, Cross-Factor Interaction, Pure Unique Asset, and Statistical Error Noise.
Column 2: Window Return
This column shows you the direct, absolute performance footprint measured in percentage points. If you add up every number in this column from top to bottom, it will perfectly equal the final Asset Total Return row at the very bottom. If the final row says +10.00%, and the Market row says +6.00%, the market tide handed your stock 6 of its 10 points of growth. A negative number means that factor acted as a brake, actively dragging your stock backward.
Column 3: Share Allocation %
While Column 2 tells you the direction and points, this column tells you pure structural influence. It answers the question: "Regardless of whether it was pulling the stock up or pushing it down, what percentage of the total steering wheel did this factor control?" This column always adds up to exactly 100.00%.
Column 4: Dynamic Profile State
This column displays the real-time operational status of the factors based on your settings. If a factor is turned off in your dropdown choice, this column will clearly say "OFF / Excluded". If a factor is active, it reveals its underlying structural strength using standard financial metrics like Beta (market scaling) or Alpha (sector outperformance).
The Ultimate Check: Look at the Header (R2)
Right at the very top of the table header, you will see a score labeled R2 (R-Squared). Think of this as the Model Accuracy Grade, scaled from 0.00 (completely guessing in the dark) to 1.00 (absolute flawless perfection).
If your R2 is 0.85, it means your chosen model successfully captured and explained 85% of everything that caused the stock to move over that time window. By toggling through models 1 to 5, you can find the framework that creates the highest R2 score, giving you definitive statistical proof of how that specific stock is actually operating.
Imagine you are looking at a single stock—let us call it SuperEco Corp—and its price just jumped up by 10 percent over the last few weeks.
If you ask a regular person why it went up, they might say, "Because it is a good stock!" But a seasoned investor knows that a stock price does not move in a vacuum. It is being pulled and pushed by different invisible forces.
This guide explains how our tracking tool uses a method called Regression to break down that 10 percent jump and reveal exactly who was responsible for the move. You do not need a background in math, economics, or statistics to understand how it works.
1. The Three Invisible Forces
Our model assumes that a stock price movement depends on three major factors:
The Market (The Rising Tide): This is the entire stock market (like the S&P 500). When the overall economy is booming, optimism runs high, and almost every stock gets lifted. If the market goes up sharply, our stock will likely get dragged up with it, purely by association.
The Sector (The Industry Wave): This is the specific neighborhood the stock lives in (such as Technology, Energy, or Healthcare). If electric vehicles are suddenly booming, all EV stocks will rise together, even the poorly managed ones, because money is pouring into that specific industry bucket.
The Stock Itself (Its Unique Engine): This is the company own secret sauce. It includes their unique products, their management team, their earnings reports, and their breakthroughs. This is what belongs only to this stock and no one else.
What is Regression?
Think of a stock total return like a baked cake. You know the cake tastes sweet (the stock went up 10 percent), but you do not know how many cups of sugar, flour, or butter went into it.
Regression is a tool that acts like a laboratory test for that cake. It analyzes the final product, compares it to how the broader market and sector were moving at the same time, and extracts the exact recipe. It tells you: "Of this 10 percent move, 5 percent was caused by the market, 3 percent was caused by the sector, and 2 percent was the stock unique engine."
2. Leftover Mystery: The Statistical Error
No matter how smart a math model is, it can never perfectly predict human behavior or random events. When we add up what the Market and the Sector should have done to the stock, it rarely perfectly matches the actual final price.
The piece that is left over is called the Statistical Error (or Noise Floor).
Think of it like static on an old television set, or the background chatter in a crowded restaurant. It represents random daily market zig-zags, algorithmic trading glitches, or minor noise that has no real structural meaning. If our model is working correctly, this error row should be very small, meaning our factors successfully explained the vast majority of the price movement.
3. The 5 Steps of Understanding: Our Dropdown Models
To help you see how these forces interact, our indicator lets you switch between 5 different structural models using a simple settings dropdown menu. Think of this like changing lenses on a camera to see the data in different ways:
Model 1: No Variables (The Blindfold View)
This model assumes that external factors do not exist. It completely ignores the market and the sector. The stock price is treated as moving entirely on its own, plus some random mystery noise. This establishes a baseline to see what the stock looks like when you isolate it from macro events.
Model 2: Market Only (The Macro Lens)
This model assumes that only the big picture matters. It watches how the stock moves in relation to the main stock market index. It tells you if your stock is just a mirror of the broader economy. If the market explains almost all of the move, your stock is behaving like an index fund.
Model 3: Sector Only (The Neighborhood Watch)
This model ignores the broader market and looks strictly at the stock specific industry group. This helps you see if the stock is simply riding an industry-wide trend or hype cycle, completely independent of whether the rest of the world markets are up or down.
Model 4: Both Market and Sector (The Parallel View)
This model looks at both forces simultaneously, but treats them as completely independent. It assumes they run side-by-side like two trains on parallel tracks. This isolates how much of the stock price was swept up by the macro economy versus how much was driven by its specific industry peer group.
Model 5: Full Interactive Model (The Chemistry Lab)
In the real world, forces do not just run on parallel tracks—they collide and alter each other. This model introduces a special Interaction Term. When a roaring market slams into a hyper-growth sector, they create a compounding synergy that accelerates or dampens stock prices. This is the most realistic model, stripping away all shared group behavior to isolate the stock true standalone engine.
4. Reading Your Screen: The Output Matrix Table Explained
When you load the script on your chart, it generates a clean summary table in your indicator pane. Here is how to interpret the four columns:
Column 1: Source Factor
This lists the different forces we are tracking: Market Component, Sector Component, Cross-Factor Interaction, Pure Unique Asset, and Statistical Error Noise.
Column 2: Window Return
This column shows you the direct, absolute performance footprint measured in percentage points. If you add up every number in this column from top to bottom, it will perfectly equal the final Asset Total Return row at the very bottom. If the final row says +10.00%, and the Market row says +6.00%, the market tide handed your stock 6 of its 10 points of growth. A negative number means that factor acted as a brake, actively dragging your stock backward.
Column 3: Share Allocation %
While Column 2 tells you the direction and points, this column tells you pure structural influence. It answers the question: "Regardless of whether it was pulling the stock up or pushing it down, what percentage of the total steering wheel did this factor control?" This column always adds up to exactly 100.00%.
Column 4: Dynamic Profile State
This column displays the real-time operational status of the factors based on your settings. If a factor is turned off in your dropdown choice, this column will clearly say "OFF / Excluded". If a factor is active, it reveals its underlying structural strength using standard financial metrics like Beta (market scaling) or Alpha (sector outperformance).
The Ultimate Check: Look at the Header (R2)
Right at the very top of the table header, you will see a score labeled R2 (R-Squared). Think of this as the Model Accuracy Grade, scaled from 0.00 (completely guessing in the dark) to 1.00 (absolute flawless perfection).
If your R2 is 0.85, it means your chosen model successfully captured and explained 85% of everything that caused the stock to move over that time window. By toggling through models 1 to 5, you can find the framework that creates the highest R2 score, giving you definitive statistical proof of how that specific stock is actually operating.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.