OPEN-SOURCE SCRIPT
Pivot Point Trend

Overview
A trend-following trailing line built from confirmed pivot highs/lows and ATR bands. The line turns green in uptrends and red in downtrends. A flip happens only when price closes on the other side of the opposite trail, helping filter noise.
How it works:
Inputs
Alerts
Usage tips
Notes on repainting
The script uses request.security(..., lookahead_off). Pivots confirm after prd bars by design; once confirmed, the center and trails do not use future data. Evaluate flips on bar close for consistency, especially when calcTF > chart TF.
Disclaimer
Educational use only. Not financial advice. Trading involves risk.
A trend-following trailing line built from confirmed pivot highs/lows and ATR bands. The line turns green in uptrends and red in downtrends. A flip happens only when price closes on the other side of the opposite trail, helping filter noise.
How it works:
- Finds confirmed swing points (pivots) and builds a smoothed center from them.
- From that center, creates ATR-based bands.
- The active trail “locks” in the trend: in uptrends it never moves down; in downtrends it never moves up.
- Close above the prior upper trail → bullish; close below the prior lower trail → bearish.
Inputs
- Pivot Point Period (prd) – strictness of pivot confirmation (delay = prd bars).
- ATR Period (pd) and ATR Factor (factor) – band width; higher values = fewer flips.
- Calculation timeframe (calcTF) – leave empty to use chart TF, or set a hard TF like 1D, 4H.
- Show Center Line – optional central guide.
- Line Width – trail thickness.
Alerts
- Bullish Flip – trend turns bullish.
- Bearish Flip – trend turns bearish.
- Trend Changed – any flip event.
Usage tips
- Typical crypto intraday starters: prd 2–5, pd 10–14, factor 2.5–3.5.
- For smoother signals, compute on a higher TF (e.g., calcTF = 1D) and time entries on your lower TF.
- Prefer actions on bar close of the calculation TF to avoid intrabar whipsaw.
Notes on repainting
The script uses request.security(..., lookahead_off). Pivots confirm after prd bars by design; once confirmed, the center and trails do not use future data. Evaluate flips on bar close for consistency, especially when calcTF > chart TF.
Disclaimer
Educational use only. Not financial advice. Trading involves risk.
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.
✅My Telegram
t.me/trading_mura
t.me/trading_mura
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.
✅My Telegram
t.me/trading_mura
t.me/trading_mura
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.