OPEN-SOURCE SCRIPT
Price Action Trend

Price Action Trend measures trend *strength* by modelling where price sits inside a smoothed price-action channel, then applying RSI to that “channel position”. It doesn’t predict, but shows what price is doing now.
This indicator uses the same calculations as my old "Price Action Trend Overlay" script, which I'd published Protected for some forgotten reason. Some users have asked for the source code, so I'm republishing it as open source. I've also tidied up the code a bit, added some visualisations of elements that were present but never drawn, such as the PA channels themselves, drawn the trend metric in a separate pane, added alerts, and made some more configuration options available.
🟩 HIGHLIGHTS
⭐ Trend colouring on the main chart.
⭐ A trend line drawn in its own pane.
⭐ Overbought/oversold markers on the main chart, derived from the same PA calculations.
⭐ Optional “Price Average” line and channel colouring.
🟩 WHAT’S UNIQUE ABOUT THE TREND CALCULATION
Most “trend RSI” tools run RSI on close, or on some moving average of price.
This script runs RSI on a *normalised* price-action series:
- We build a smoothed channel from RMA(high) and RMA(low).
- We normalise price against that channel (relative to the channel midpoint and width).
- We run RSI on that normalised series (default 14, but optionally matched to the Trend Lookback Period).
Using highs and lows instead of close or OHLC4 makes the trend value sensitive to *range shape* and *asymmetry* (big wicks, uneven extremes), not just the centre of the candle.
As compared to a simple RSI (also included simply for comparison), this PA Trend tends to decay faster and recovers faster.
🟩 HOW TO USE IT (PRACTICAL)
⭐ Trend pane
- Treat the line as a measure of *trend strength*, not a prediction.
- Neutral zone = trend is not convincingly bullish or bearish.
- Strong moves away from neutral = “trend has conviction”.
⭐ Overbought / oversold markers
Overbought/oversold doesn’t mean “reversal right now”.
It means the *rate of directional change* is unsustainably strong.
- Overbought in an uptrend: trend is overheating. Tighten long stops; expect rest/retrace/reversal once overheating ends.
- Oversold in an uptrend: the countertrend down is likely exhausting. Potential “buy the dip” context.
- Reverse the above for downtrends.
This works on any market, any timeframe. Lower timeframes will be choppier.
Don’t trade these signals blindly; use market structure, S/R, and your other tools.
🟩 SETTINGS (OVERVIEW)
🟦 Settings
- Pane Plot Mode: choose whether the pane shows Trend or Overbought/Oversold series.
- Trend Lookback Period: channel smoothing for the trend model (higher = smoother, lower = faster).
- Show Overbought & Oversold Shapes: show/hide the triangles on the main chart.
- Overbought/sold Lookback Period: channel smoothing for OB/OS detection (lower = more sensitive).
- Overbought/sold Adaptive Length: smoothing for the dynamic OB/OS levels (lower = more adaptive).
🟦 Display
- Transparency for the candle colour: bar colour transparency (Gradient mode).
- Trend Colour Mode: Classic vs strength-based Gradient.
🟦 Price Average
- Show Price Average: show/hide the OHLC4 average price line.
- Lookback: length for the price average.
- Smoothing: SMA / EMA / RMA.
- Colour Channel by Price Average: neutral/green/red channel colouring depending on whether the price average is inside/above/below the channel.
🟦 Advanced
- Trend Upper/Lower Neutral Threshold: neutral zone bounds (also used by the dynamic OB/OS logic).
- PA RSI Length: choose Fixed (14) or match the Trend Lookback Period.
- Show RSI (close): optional “reference RSI” plot with length.
🟩 ALERTS
There are built-in alert conditions for this indicator:
- Overbought PA Trend: triggers when the PA overbought condition is true.
- Oversold PA Trend: triggers when the PA oversold condition is true.
- Trend flips up: triggers when the trend changes from down to up (ignores any intervening neutral bars).
- Trend flips down: triggers when the trend changes from up to down (ignores any intervening neutral bars).
- Lost overbought: triggers on the first red candle after the overbought condition ends (set this alert on close to avoid false alerts).
- Lost oversold: triggers on the first green candle after the oversold condition ends (set this alert on close to avoid false alerts).
🟩 REPAINTING / CALCULATION NOTES
According to my understanding, this indicator does not repaint (it does not go back and alter closed bars).
However, while the current candle is forming, values that depend on the current price will update in real time. Once the candle closes, they are fixed.
The overbought/oversold calculations use Williams fractal-style confirmation logic, which cannot be known until some bars afterwards.
This affects when the OB/OS levels update, but new confirmations only affect future calculations, not the past.
🟩 CREDITS
The idea for using smoothed highs/lows to create a price-action channel came from my humble trading mentor. All the code is my own.
🟩 DISCLAIMER
No indicator is a substitute for knowing what you’re doing.
By using this indicator you agree that it might not do what you or anyone else expects.
You retain full responsibility for your trading at all times.
Before trading with actual money, first make sure your risk management is professional-level.
This indicator uses the same calculations as my old "Price Action Trend Overlay" script, which I'd published Protected for some forgotten reason. Some users have asked for the source code, so I'm republishing it as open source. I've also tidied up the code a bit, added some visualisations of elements that were present but never drawn, such as the PA channels themselves, drawn the trend metric in a separate pane, added alerts, and made some more configuration options available.
🟩 HIGHLIGHTS
⭐ Trend colouring on the main chart.
⭐ A trend line drawn in its own pane.
⭐ Overbought/oversold markers on the main chart, derived from the same PA calculations.
⭐ Optional “Price Average” line and channel colouring.
🟩 WHAT’S UNIQUE ABOUT THE TREND CALCULATION
Most “trend RSI” tools run RSI on close, or on some moving average of price.
This script runs RSI on a *normalised* price-action series:
- We build a smoothed channel from RMA(high) and RMA(low).
- We normalise price against that channel (relative to the channel midpoint and width).
- We run RSI on that normalised series (default 14, but optionally matched to the Trend Lookback Period).
Using highs and lows instead of close or OHLC4 makes the trend value sensitive to *range shape* and *asymmetry* (big wicks, uneven extremes), not just the centre of the candle.
As compared to a simple RSI (also included simply for comparison), this PA Trend tends to decay faster and recovers faster.
🟩 HOW TO USE IT (PRACTICAL)
⭐ Trend pane
- Treat the line as a measure of *trend strength*, not a prediction.
- Neutral zone = trend is not convincingly bullish or bearish.
- Strong moves away from neutral = “trend has conviction”.
⭐ Overbought / oversold markers
Overbought/oversold doesn’t mean “reversal right now”.
It means the *rate of directional change* is unsustainably strong.
- Overbought in an uptrend: trend is overheating. Tighten long stops; expect rest/retrace/reversal once overheating ends.
- Oversold in an uptrend: the countertrend down is likely exhausting. Potential “buy the dip” context.
- Reverse the above for downtrends.
This works on any market, any timeframe. Lower timeframes will be choppier.
Don’t trade these signals blindly; use market structure, S/R, and your other tools.
🟩 SETTINGS (OVERVIEW)
🟦 Settings
- Pane Plot Mode: choose whether the pane shows Trend or Overbought/Oversold series.
- Trend Lookback Period: channel smoothing for the trend model (higher = smoother, lower = faster).
- Show Overbought & Oversold Shapes: show/hide the triangles on the main chart.
- Overbought/sold Lookback Period: channel smoothing for OB/OS detection (lower = more sensitive).
- Overbought/sold Adaptive Length: smoothing for the dynamic OB/OS levels (lower = more adaptive).
🟦 Display
- Transparency for the candle colour: bar colour transparency (Gradient mode).
- Trend Colour Mode: Classic vs strength-based Gradient.
🟦 Price Average
- Show Price Average: show/hide the OHLC4 average price line.
- Lookback: length for the price average.
- Smoothing: SMA / EMA / RMA.
- Colour Channel by Price Average: neutral/green/red channel colouring depending on whether the price average is inside/above/below the channel.
🟦 Advanced
- Trend Upper/Lower Neutral Threshold: neutral zone bounds (also used by the dynamic OB/OS logic).
- PA RSI Length: choose Fixed (14) or match the Trend Lookback Period.
- Show RSI (close): optional “reference RSI” plot with length.
🟩 ALERTS
There are built-in alert conditions for this indicator:
- Overbought PA Trend: triggers when the PA overbought condition is true.
- Oversold PA Trend: triggers when the PA oversold condition is true.
- Trend flips up: triggers when the trend changes from down to up (ignores any intervening neutral bars).
- Trend flips down: triggers when the trend changes from up to down (ignores any intervening neutral bars).
- Lost overbought: triggers on the first red candle after the overbought condition ends (set this alert on close to avoid false alerts).
- Lost oversold: triggers on the first green candle after the oversold condition ends (set this alert on close to avoid false alerts).
🟩 REPAINTING / CALCULATION NOTES
According to my understanding, this indicator does not repaint (it does not go back and alter closed bars).
However, while the current candle is forming, values that depend on the current price will update in real time. Once the candle closes, they are fixed.
The overbought/oversold calculations use Williams fractal-style confirmation logic, which cannot be known until some bars afterwards.
This affects when the OB/OS levels update, but new confirmations only affect future calculations, not the past.
🟩 CREDITS
The idea for using smoothed highs/lows to create a price-action channel came from my humble trading mentor. All the code is my own.
🟩 DISCLAIMER
No indicator is a substitute for knowing what you’re doing.
By using this indicator you agree that it might not do what you or anyone else expects.
You retain full responsibility for your trading at all times.
Before trading with actual money, first make sure your risk management is professional-level.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
🆓 All my free scripts: is.gd/simplefree
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
🆓 All my free scripts: is.gd/simplefree
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
🔥 Beyond Market Structure Paid Space is now live! is.gd/beyondMS
💰 Trade with me: is.gd/simpletradewithme
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.