OPEN-SOURCE SCRIPT
Endogenous Macro Heatmap [invincible3]

Endogenous Macro Heatmap [invincible3]
The Endogenous Macro Heatmap is a multi-factor macroeconomic dashboard designed to show the internal economic condition of a selected country in a compact table format directly on the chart.
Unlike cross-country or exogenous comparison models, this indicator focuses on domestic macro conditions : growth, production, demand, liquidity, rates, inflation, employment, fiscal position, debt pressure, and central bank balance sheet behavior.
The goal is to help traders, investors, and macro analysts quickly assess whether a country’s internal economic backdrop is improving, neutral, weakening, or entering a stress phase.
The indicator uses a heatmap structure so that changes in the macro environment can be understood visually. Stronger readings are shown through the positive color gradient, weaker readings through the negative color gradient, and balanced or transition zones through the neutral color.
What This Indicator Measures
The heatmap tracks a broad set of endogenous macro variables, including:
Because macro data availability differs across countries, the script automatically substitutes certain fields where required. For example, some countries may use construction output, construction orders, housing starts, or capacity utilization depending on what is available in the TradingView economic database.
Supported Countries
The dashboard currently supports:
Each country uses its corresponding TradingView economic code where available.
Composite Macro Score
The final Score column converts multiple macro readings into a single composite score from 0 to 100.
The score is grouped into four macro blocks:
1. Growth Block
Includes GDP, manufacturing, new orders, construction/building activity, retail sales, and employment.
This block has the largest weight because real economic momentum is the primary driver of macro regime strength.
2. Liquidity Block
Includes money supply and central bank balance sheet data.
This block helps identify whether domestic liquidity conditions are expanding or contracting.
3. Tightness Block
Includes 10-year yield and interest rate conditions.
This block helps measure whether financial conditions are becoming easier or tighter.
4. Stability Block
Includes inflation, debt/GDP, and government budget data.
This block helps detect macro pressure from inflation, fiscal stress, or excessive debt burden.
The composite score is weighted as follows:
Score Interpretation
The score is displayed as a clean numeric value without extra symbols, making the table easier to read.
General interpretation:
The score should not be interpreted as a direct buy or sell signal. It is a macro regime filter designed to provide context.
Heatmap Color Logic
The table uses a simple and consistent three-color structure:
The color system is intentionally matched with the Exogenous Heatmap style, allowing both dashboards to be used together with a consistent visual language.
Each macro field also includes an **Up Good** setting. This allows the user to define whether higher values are favorable or unfavorable for each metric.
For example:
This flexibility allows the heatmap to be adapted for different economic regimes and analytical preferences.
Auto and Manual Scaling
The indicator includes an automatic macro gradient scale.
When auto scaling is enabled, the heatmap normalizes each metric based on the visible historical table range. This makes the table visually adaptive and easier to compare across different periods.
Manual scaling is also available for users who prefer fixed macro ranges.
This is useful when comparing the same country across different time periods or when the user wants a stable visual reference.
Timeframe and History Controls
Users can select the table period:
The data can be fetched by:
This gives flexibility for short-term macro monitoring as well as longer-term economic cycle analysis.
Table Customization
The dashboard includes several table display settings:
The table automatically adapts to the chart background and foreground colors for better readability on both dark and light chart themes.
How to Use
This indicator is best used as a macro context tool.
A practical workflow:
1. Select the country you want to analyze.
2. Choose the table period, such as monthly or quarterly.
3. Review the color trend across the macro fields.
4. Watch whether growth, liquidity, tightness, and stability are improving or deteriorating together.
5. Use the composite score as a broad internal macro regime filter.
6. Combine the macro backdrop with price action, trend, liquidity, sector rotation, and risk management.
For example:
Suggested Use Cases
This heatmap can be useful for:
Important Notes
Economic data can be revised, delayed, or unavailable depending on the country and TradingView’s data coverage.
Some fields may not exist for every country, so the script uses alternative fields where possible.
The heatmap is designed for macro analysis and educational research. It does not predict price direction by itself and should not be used as a standalone trading system.
Always combine macro signals with technical analysis, market structure, liquidity conditions, and proper risk management.
Disclaimer
This script is for educational and analytical purposes only. It is not financial advice, investment advice, or a recommendation to buy or sell any asset.
Markets are influenced by many factors beyond macroeconomic data, including positioning, liquidity, earnings, policy changes, geopolitical events, and sentiment. Use this tool as one layer of a broader decision-making process.
The Endogenous Macro Heatmap is a multi-factor macroeconomic dashboard designed to show the internal economic condition of a selected country in a compact table format directly on the chart.
Unlike cross-country or exogenous comparison models, this indicator focuses on domestic macro conditions : growth, production, demand, liquidity, rates, inflation, employment, fiscal position, debt pressure, and central bank balance sheet behavior.
The goal is to help traders, investors, and macro analysts quickly assess whether a country’s internal economic backdrop is improving, neutral, weakening, or entering a stress phase.
The indicator uses a heatmap structure so that changes in the macro environment can be understood visually. Stronger readings are shown through the positive color gradient, weaker readings through the negative color gradient, and balanced or transition zones through the neutral color.
What This Indicator Measures
The heatmap tracks a broad set of endogenous macro variables, including:
- GDP year-over-year growth
- Manufacturing production / manufacturing index
- New orders or capacity utilization
- Building permits, construction output, construction orders, or housing starts depending on the selected country
- Retail sales year-over-year
- Money supply
- 10-year government bond yield
- Interest rate
- Inflation year-over-year
- Employment-related data
- Debt-to-GDP
- Government budget
- Central bank balance sheet
Because macro data availability differs across countries, the script automatically substitutes certain fields where required. For example, some countries may use construction output, construction orders, housing starts, or capacity utilization depending on what is available in the TradingView economic database.
Supported Countries
The dashboard currently supports:
- United States
- United Kingdom
- Euro Area
- Germany
- France
- Italy
- Canada
- Japan
- China
- Australia
- South Korea
- New Zealand
Each country uses its corresponding TradingView economic code where available.
Composite Macro Score
The final Score column converts multiple macro readings into a single composite score from 0 to 100.
The score is grouped into four macro blocks:
1. Growth Block
Includes GDP, manufacturing, new orders, construction/building activity, retail sales, and employment.
This block has the largest weight because real economic momentum is the primary driver of macro regime strength.
2. Liquidity Block
Includes money supply and central bank balance sheet data.
This block helps identify whether domestic liquidity conditions are expanding or contracting.
3. Tightness Block
Includes 10-year yield and interest rate conditions.
This block helps measure whether financial conditions are becoming easier or tighter.
4. Stability Block
Includes inflation, debt/GDP, and government budget data.
This block helps detect macro pressure from inflation, fiscal stress, or excessive debt burden.
The composite score is weighted as follows:
- Growth: 45%
- Liquidity: 20%
- Tightness: 20%
- Stability: 15%
Score Interpretation
The score is displayed as a clean numeric value without extra symbols, making the table easier to read.
General interpretation:
- 70–100: Strong macro condition
- 55–69: Positive / improving condition
- 45–54: Neutral / transition condition
- 30–44: Weak condition
- Below 30: Stress condition
The score should not be interpreted as a direct buy or sell signal. It is a macro regime filter designed to provide context.
Heatmap Color Logic
The table uses a simple and consistent three-color structure:
- Positive color: stronger or favorable macro readings
- Neutral color: balanced or mid-range readings
- Negative color: weaker or unfavorable macro readings
The color system is intentionally matched with the Exogenous Heatmap style, allowing both dashboards to be used together with a consistent visual language.
Each macro field also includes an **Up Good** setting. This allows the user to define whether higher values are favorable or unfavorable for each metric.
For example:
- Higher GDP growth is generally positive.
- Higher manufacturing activity is generally positive.
- Higher liquidity can be positive.
- Higher inflation, debt, or rates may be interpreted differently depending on the user’s macro framework.
This flexibility allows the heatmap to be adapted for different economic regimes and analytical preferences.
Auto and Manual Scaling
The indicator includes an automatic macro gradient scale.
When auto scaling is enabled, the heatmap normalizes each metric based on the visible historical table range. This makes the table visually adaptive and easier to compare across different periods.
Manual scaling is also available for users who prefer fixed macro ranges.
This is useful when comparing the same country across different time periods or when the user wants a stable visual reference.
Timeframe and History Controls
Users can select the table period:
- Yearly
- Quarterly
- Monthly
- Weekly
- Daily
The data can be fetched by:
- A fixed number of periods
- A selected start date
This gives flexibility for short-term macro monitoring as well as longer-term economic cycle analysis.
Table Customization
The dashboard includes several table display settings:
- Show or hide table
- Select table position
- Select table size
- Customize positive, neutral, and negative colors
The table automatically adapts to the chart background and foreground colors for better readability on both dark and light chart themes.
How to Use
This indicator is best used as a macro context tool.
A practical workflow:
1. Select the country you want to analyze.
2. Choose the table period, such as monthly or quarterly.
3. Review the color trend across the macro fields.
4. Watch whether growth, liquidity, tightness, and stability are improving or deteriorating together.
5. Use the composite score as a broad internal macro regime filter.
6. Combine the macro backdrop with price action, trend, liquidity, sector rotation, and risk management.
For example:
- A rising score with improving growth and liquidity may support a risk-on environment.
- A falling score with weakening growth and tightening conditions may warn of macro deterioration.
- A neutral score may indicate a transition period where markets can become more sensitive to new economic data.
Suggested Use Cases
This heatmap can be useful for:
- Macro regime analysis
- Country-level economic monitoring
- Risk-on / risk-off context
- Equity index analysis
- Bond market context
- Currency market macro background
- Sector rotation research
- Long-term investment cycle analysis
- Comparing domestic conditions with external macro pressure when used together with an exogenous heatmap
Important Notes
Economic data can be revised, delayed, or unavailable depending on the country and TradingView’s data coverage.
Some fields may not exist for every country, so the script uses alternative fields where possible.
The heatmap is designed for macro analysis and educational research. It does not predict price direction by itself and should not be used as a standalone trading system.
Always combine macro signals with technical analysis, market structure, liquidity conditions, and proper risk management.
Disclaimer
This script is for educational and analytical purposes only. It is not financial advice, investment advice, or a recommendation to buy or sell any asset.
Markets are influenced by many factors beyond macroeconomic data, including positioning, liquidity, earnings, policy changes, geopolitical events, and sentiment. Use this tool as one layer of a broader decision-making process.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。