OPEN-SOURCE SCRIPT
Dow Theory Indicator

## 🎯 Key Features of the Indicator
### 📈 Complete Implementation of Dow Theory
- Three-tier trend structure: primary trend (50 periods), secondary trend (20 periods), and minor trend (10 periods).
- Swing point analysis: automatically detects critical swing highs and lows.
- Trend confirmation mechanism: strict confirmation logic based on consecutive higher highs/higher lows or lower highs/lower lows.
- Volume confirmation: ensures price moves are supported by trading volume.
### 🕐 Flexible Timeframe Parameters
All key parameters are adjustable, making it especially suitable for U.S. equities:
Trend analysis parameters:
- Primary trend period: 20–200 (default 50; recommended 50–100 for U.S. stocks).
- Secondary trend period: 10–100 (default 20; recommended 15–30 for U.S. stocks).
- Minor trend period: 5–50 (default 10; recommended 5–15 for U.S. stocks).
Dow Theory parameters:
- Swing high/low lookback: 5–50 (default 10).
- Trend confirmation bar count: 1–10 (default 3).
- Volume confirmation period: 10–100 (default 20).
### 🇺🇸 U.S. Market Optimizations
- Session awareness: distinguishes Regular Trading Hours (9:30–16:00 EST) from pre-market and after-hours.
- Pre/post-market weighting: adjustable weighting factor for signals during extended hours.
- Earnings season filter: automatically adjusts sensitivity during earnings periods.
- U.S.-optimized default parameters.
## 🎨 Visualization
1. Trend lines: three differently colored trend lines.
2. Background fill: green (uptrend) / red (downtrend) / gray (neutral).
3. Signal markers: arrows, labels, and warning icons.
4. Swing point markers: small triangles at key turning points.
5. Info panel: real-time display of eight key metrics.
## 🚨 Alert System
- Trend turning to up/down.
- Strong bullish/bearish signals (dual confirmation).
- Volume divergence warning.
- New swing high/low formed.
## 📋 How to Use
1. Open the Pine Editor in TradingView.
2. Copy the contents of dow_theory_indicator.pine.
3. Paste and click “Add to chart.”
4. Adjust parameters based on trading style:
- Long-term investing: increase all period parameters.
- Swing trading: use the default parameters.
- Short-term trading: decrease all period parameters.
## 💡 Parameter Tips for U.S. Stocks
- Large-cap blue chips (AAPL, MSFT): primary 60–80, secondary 25–30.
- Mid-cap growth stocks: primary 40–60, secondary 18–25.
- Small-cap high-volatility stocks: primary 30–50, secondary 15–20.[1][2][3]
### 📈 Complete Implementation of Dow Theory
- Three-tier trend structure: primary trend (50 periods), secondary trend (20 periods), and minor trend (10 periods).
- Swing point analysis: automatically detects critical swing highs and lows.
- Trend confirmation mechanism: strict confirmation logic based on consecutive higher highs/higher lows or lower highs/lower lows.
- Volume confirmation: ensures price moves are supported by trading volume.
### 🕐 Flexible Timeframe Parameters
All key parameters are adjustable, making it especially suitable for U.S. equities:
Trend analysis parameters:
- Primary trend period: 20–200 (default 50; recommended 50–100 for U.S. stocks).
- Secondary trend period: 10–100 (default 20; recommended 15–30 for U.S. stocks).
- Minor trend period: 5–50 (default 10; recommended 5–15 for U.S. stocks).
Dow Theory parameters:
- Swing high/low lookback: 5–50 (default 10).
- Trend confirmation bar count: 1–10 (default 3).
- Volume confirmation period: 10–100 (default 20).
### 🇺🇸 U.S. Market Optimizations
- Session awareness: distinguishes Regular Trading Hours (9:30–16:00 EST) from pre-market and after-hours.
- Pre/post-market weighting: adjustable weighting factor for signals during extended hours.
- Earnings season filter: automatically adjusts sensitivity during earnings periods.
- U.S.-optimized default parameters.
## 🎨 Visualization
1. Trend lines: three differently colored trend lines.
2. Background fill: green (uptrend) / red (downtrend) / gray (neutral).
3. Signal markers: arrows, labels, and warning icons.
4. Swing point markers: small triangles at key turning points.
5. Info panel: real-time display of eight key metrics.
## 🚨 Alert System
- Trend turning to up/down.
- Strong bullish/bearish signals (dual confirmation).
- Volume divergence warning.
- New swing high/low formed.
## 📋 How to Use
1. Open the Pine Editor in TradingView.
2. Copy the contents of dow_theory_indicator.pine.
3. Paste and click “Add to chart.”
4. Adjust parameters based on trading style:
- Long-term investing: increase all period parameters.
- Swing trading: use the default parameters.
- Short-term trading: decrease all period parameters.
## 💡 Parameter Tips for U.S. Stocks
- Large-cap blue chips (AAPL, MSFT): primary 60–80, secondary 25–30.
- Mid-cap growth stocks: primary 40–60, secondary 18–25.
- Small-cap high-volatility stocks: primary 30–50, secondary 15–20.[1][2][3]
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.