OPEN-SOURCE SCRIPT
Trend Pulse Oscillator

█ OVERVIEW
Trend Pulse Oscillator is a momentum oscillator that combines short-term trend strength analysis (price deviation from a dynamic trend line) with optional reference to a higher timeframe trend context. It visualizes market pulse through smoothed oscillator waves, fixed overbought/oversold levels, and zero-line cross signals indicating momentum shifts.
The indicator assists in identifying potential entry points after strong moves, early signs of exhaustion or direction change, and supports decision-making by providing longer-period trend awareness
█ CONCEPT
Built upon the SwiftTrend logic. The core idea is to measure how far price deviates from the adaptive trend line (margin line). Greater deviation in the direction of the trend indicates stronger momentum. When price returns toward the trend line — especially from overbought or oversold zones — it often signals a correction or potential reversal.
- The oscillator displays the deviation of price from the trend line and applies user-selected smoothing (EMA, SMA, RMA, WMA).
- The longer-period trend controls candle coloring (SwiftTrend candles) and can be used discretionarily as a directional bias/filter for signals.
- The color of the oscillator itself depends solely on whether the smoothed value is above or below zero (green above, red below).
Fixed OB/OS levels and the zero line help visually evaluate the strength of the deviation. Areas significantly above the OB level or below the OS level indicate extreme price stretch away from the trend line and increased probability of mean reversion.
█ FEATURES
Calculations
- Average candle body size — calculated separately for oscillator and longer-period trend
- Dynamic trend line (adaptive margin line) + fixed OB / OS threshold levels
- Multiple oscillator smoothing options
- Momentum expressed as oscillating waves
- Detection of OB/OS crossovers and zero-line breaks
Visualization
- Oscillator waves colored according to sign (green above zero, red below zero)
- Fixed OS level (oversold) — gray, dashed line
- OB level (overbought) — color reflects the current longer-period trend direction (green when price is above the longer-period trend line, red when below)
- OB and OS levels frequently displayed with light gradient fill for readability (OB gradient inherits HTF trend color; OS gradient remains neutral/gray)
- Optional SwiftTrend candle coloring — candles colored according to longer-term trend direction and strength (gradient intensity)
- Transparent, layered fill under oscillator waves (stronger near the wave, fading toward zero)
Signals
- Long / Short — triggered on crossover/crossunder of OB/OS levels (with anti-duplication logic per wave)
- Zero Line Long / Zero Line Short — zero-line break confirmed by candle color direction
- Longer-period trend change — visual and alert when longer-term trend flips
- Important: There is no automatic filtering of OB/OS or zero-line signals by the longer-period trend — traders should apply longer-period trend bias manually
Alerts
- Long Signal
- Short Signal
- Zero Line Long
- Zero Line Short
- Longer-Period Trend Change
█ HOW TO USE
Add the indicator via Pine Editor (paste the code) or search for “Trend Pulse Oscillator” in the TradingView public library.
Main settings
- Osc Average Body Periods – averaging period for oscillator body size
- Osc Band Multiplier / Tolerance Multiplier – controls width and sensitivity of oscillator bands
- Smoothing Type / Length – smoothing method and period for the oscillator wave
- Trend Average Body Periods / Band / Tolerance – parameters for the longer-period trend line
- Overbought Level / Oversold Level – fixed threshold values
- Enable Candle Coloring – turns on SwiftTrend-style candle coloring based on the longer-period trend
- Gradient & fill options – control visibility and transparency of gradients and wave fills
Trend & candle coloring logic
- Price above trend line → bullish (green tones)
- Price below trend line → bearish (red tones)
█ APPLICATION
Momentum trading
- Direction and slope of oscillator waves indicate current impulse strength
- Return toward zero or zero-line cross can serve as an early warning of correction or reversal
Trend following
- The longer-period trend acts as a discretionary directional filter
- Highest-probability approach: take signals primarily in the direction of the longer-period trend
Overbought / Oversold
- Fixed OB/OS levels mark zones of extreme deviation from the trend line
- Large extensions away from the trend line increase the likelihood of pullback or reversal
█ NOTES
- This is a supporting tool — never use it as a standalone trading system
- Best results are achieved when combined with key support/resistance levels, market structure analysis, and longer-period trend context
- OB/OS crosses and zero-line breaks are orientation points only — always validate them against the broader trend picture
Trend Pulse Oscillator is a momentum oscillator that combines short-term trend strength analysis (price deviation from a dynamic trend line) with optional reference to a higher timeframe trend context. It visualizes market pulse through smoothed oscillator waves, fixed overbought/oversold levels, and zero-line cross signals indicating momentum shifts.
The indicator assists in identifying potential entry points after strong moves, early signs of exhaustion or direction change, and supports decision-making by providing longer-period trend awareness
█ CONCEPT
Built upon the SwiftTrend logic. The core idea is to measure how far price deviates from the adaptive trend line (margin line). Greater deviation in the direction of the trend indicates stronger momentum. When price returns toward the trend line — especially from overbought or oversold zones — it often signals a correction or potential reversal.
- The oscillator displays the deviation of price from the trend line and applies user-selected smoothing (EMA, SMA, RMA, WMA).
- The longer-period trend controls candle coloring (SwiftTrend candles) and can be used discretionarily as a directional bias/filter for signals.
- The color of the oscillator itself depends solely on whether the smoothed value is above or below zero (green above, red below).
Fixed OB/OS levels and the zero line help visually evaluate the strength of the deviation. Areas significantly above the OB level or below the OS level indicate extreme price stretch away from the trend line and increased probability of mean reversion.
█ FEATURES
Calculations
- Average candle body size — calculated separately for oscillator and longer-period trend
- Dynamic trend line (adaptive margin line) + fixed OB / OS threshold levels
- Multiple oscillator smoothing options
- Momentum expressed as oscillating waves
- Detection of OB/OS crossovers and zero-line breaks
Visualization
- Oscillator waves colored according to sign (green above zero, red below zero)
- Fixed OS level (oversold) — gray, dashed line
- OB level (overbought) — color reflects the current longer-period trend direction (green when price is above the longer-period trend line, red when below)
- OB and OS levels frequently displayed with light gradient fill for readability (OB gradient inherits HTF trend color; OS gradient remains neutral/gray)
- Optional SwiftTrend candle coloring — candles colored according to longer-term trend direction and strength (gradient intensity)
- Transparent, layered fill under oscillator waves (stronger near the wave, fading toward zero)
Signals
- Long / Short — triggered on crossover/crossunder of OB/OS levels (with anti-duplication logic per wave)
- Zero Line Long / Zero Line Short — zero-line break confirmed by candle color direction
- Longer-period trend change — visual and alert when longer-term trend flips
- Important: There is no automatic filtering of OB/OS or zero-line signals by the longer-period trend — traders should apply longer-period trend bias manually
Alerts
- Long Signal
- Short Signal
- Zero Line Long
- Zero Line Short
- Longer-Period Trend Change
█ HOW TO USE
Add the indicator via Pine Editor (paste the code) or search for “Trend Pulse Oscillator” in the TradingView public library.
Main settings
- Osc Average Body Periods – averaging period for oscillator body size
- Osc Band Multiplier / Tolerance Multiplier – controls width and sensitivity of oscillator bands
- Smoothing Type / Length – smoothing method and period for the oscillator wave
- Trend Average Body Periods / Band / Tolerance – parameters for the longer-period trend line
- Overbought Level / Oversold Level – fixed threshold values
- Enable Candle Coloring – turns on SwiftTrend-style candle coloring based on the longer-period trend
- Gradient & fill options – control visibility and transparency of gradients and wave fills
Trend & candle coloring logic
- Price above trend line → bullish (green tones)
- Price below trend line → bearish (red tones)
█ APPLICATION
Momentum trading
- Direction and slope of oscillator waves indicate current impulse strength
- Return toward zero or zero-line cross can serve as an early warning of correction or reversal
Trend following
- The longer-period trend acts as a discretionary directional filter
- Highest-probability approach: take signals primarily in the direction of the longer-period trend
Overbought / Oversold
- Fixed OB/OS levels mark zones of extreme deviation from the trend line
- Large extensions away from the trend line increase the likelihood of pullback or reversal
█ NOTES
- This is a supporting tool — never use it as a standalone trading system
- Best results are achieved when combined with key support/resistance levels, market structure analysis, and longer-period trend context
- OB/OS crosses and zero-line breaks are orientation points only — always validate them against the broader trend picture
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน