OPEN-SOURCE SCRIPT
Moving Averages Power

-----------------------------------------------------------------------------
This is a README in Pine Script format for TradingView publication.
It contains usage docs in comments and a no-op plot so it uploads without issue.
For the actual indicator, use: moving_averages_simple.pine
-----------------------------------------------------------------------------
plot(na) no-op to keep the script valid without drawing anything
=============================================================================
Moving Averages (5–4320) — Trend + Normalized Strength
=============================================================================
Lightweight indicator that plots up to 15 SMAs (5 → 4320) and shows a compact
table with each MA’s:
- Slope % (per-bar)
- Trend (Bullish/Bearish/Neutral)
- Normalized “Strength” bars comparable across MA lengths and, optionally,
across timeframes via ATR%
Not financial advice. For research/education only.
----------------------------------------------------------------------------
Scope
----------------------------------------------------------------------------
- Simple Moving Averages (SMA) only
- Periods: 5, 10, 20, 30, 60, 120, 160, 240, 480, 720, 960, 1440, 1750, 2880, 4320
- Overlays lines + end-of-series labels; adds a 4×16 table (bottom-right)
- Strength normalization modes: None, Length, ATR%, Length+ATR%
----------------------------------------------------------------------------
Key Features
----------------------------------------------------------------------------
- 15 SMA lines on one chart
- Line/label/table colors reflect trend:
• Bullish (slope > 0): green
• Bearish (slope < 0): red
• Neutral (otherwise): gray
- Normalized Strength bars comparable across MA lengths and (optionally) across
timeframes via ATR%
- Show/hide any SMA; adjustable font sizes for labels and table
----------------------------------------------------------------------------
Installation (TradingView)
----------------------------------------------------------------------------
1) Open TradingView → any chart → Pine Editor
2) Create a new script and paste the contents of moving_averages_simple.pine
3) Save → Add to chart
4) Open Settings to customize inputs
(This README.pine is just documentation. It does not draw lines or the table.)
----------------------------------------------------------------------------
Usage
----------------------------------------------------------------------------
Table columns:
- MA: the moving average period
- Slope %: per-bar percent change of the MA
slope% = 100 × (MA − MA[1]) / MA[1]
- Trend: Bullish (green), Bearish (red), Neutral (gray)
- Strength: a bar of ▮ characters, computed from normalized strength and
clamped to a max (default 10 bars)
Strength normalization (S):
- None: S = |slope%|
- Length: S = |slope%| × (length / normRefLen)
- ATR%: S = |slope%| / ATR%, where ATR% = 100 × ATR(atrLen) / close
- Length+ATR%: S = (|slope%| × (length / normRefLen)) / ATR%
Bars: bars = floor(S / strengthStep), clamped to maxStrengthBars
Notes:
- normRefLen (default 240) stabilizes Length scaling across very short/long MAs
- In ATR modes, Strength is blank until ATR is ready (requires atrLen bars)
----------------------------------------------------------------------------
Inputs (Settings)
----------------------------------------------------------------------------
- Display: 15 toggles to show/hide SMA 5 … SMA 4320
- Text Settings: Label font size; Table font size
- Strength Settings:
• Strength normalization: None | Length | ATR% | Length+ATR%
• Strength step (normalized units): sensitivity of bar count
• Max bars: clamp for bar count (default 10)
• Normalization reference length: baseline for Length scaling (default 240)
• ATR Length (for ATR% normalization): ATR lookback for ATR%
----------------------------------------------------------------------------
Recommended presets
----------------------------------------------------------------------------
Intraday (e.g., BTCUSD, 1h):
- Normalization: Length+ATR%
- normRefLen: 240
- Strength step: 0.02–0.05
- Max bars: 10
- ATR Length: 14
Daily (e.g., AAPL, 1D):
- Normalization: Length
- normRefLen: 240–480
- Strength step: 0.01–0.03
- Max bars: 10
----------------------------------------------------------------------------
Calibration tips
----------------------------------------------------------------------------
Bars often maxed (pegged)?
- Increase Strength step (e.g., 0.01 → 0.03 → 0.05)
- Or increase normRefLen (e.g., 240 → 480 → 720)
Bars too few?
- Decrease Strength step (e.g., 0.02 → 0.01 → 0.005)
- Or decrease normRefLen (e.g., 240 → 120)
Cross-timeframe comparability:
- Prefer Length+ATR%; start with Strength step ≈ 0.02–0.05 and tune
----------------------------------------------------------------------------
Limitations
----------------------------------------------------------------------------
- SMA only (no EMA/WMA/etc.)
- Per-bar slope is timeframe-sensitive; use ATR% or Length+ATR% for better
cross-timeframe comparisons
- ATR modes require atrLen bars; Strength shows blank until ready
- Longest SMA (4320) needs sufficient chart history
----------------------------------------------------------------------------
Troubleshooting
----------------------------------------------------------------------------
- Strength always maxed:
• Using Length mode with too-small step → increase step and/or use Length+ATR%
• Review normRefLen (higher ref length dampens long MAs)
- Strength blank cells:
• In ATR modes, wait for atrLen bars or use Length mode
- Table bounds:
• If you customize periods or table size in the main script, keep header at
row 0 and at most 15 data rows (4×16 table)
----------------------------------------------------------------------------
Compatibility
----------------------------------------------------------------------------
- Pine Script v6
- Works on most symbols/timeframes with adequate history
----------------------------------------------------------------------------
Credits & Feedback
----------------------------------------------------------------------------
If you find this useful, consider sharing your preferred defaults (symbol/
timeframe) so better presets can be added. PRs/issues welcome in the repo.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.