OPEN-SOURCE SCRIPT
Updated TREV Candles - Range-Based Trend Reversal

TREV Candles - Range-Based Trend Reversal Chart Implementation
What is a Trend Reversal (TREV) Chart?
A Trend Reversal chart, also known as a Point & Figure chart variation, is a unique charting method that focuses on price movement thresholds rather than time intervals. Unlike traditional candlestick charts where each candle represents a fixed time period, TREV candles form only when price moves by predefined amounts in ticks.
How TREV Candles Work
This indicator implements true TREV logic with two critical thresholds:
Key TREV Rules Enforced:
Four Distinct Candle Types
Practical Trading Applications
Technical Implementation Features
Comprehensive Styling Options
Each of the four candle types offers complete visual customization:
Default Color Scheme:
Configuration Guidelines
Ideal Use Cases
Why This Implementation is Superior
Perfect for traders who want to see beyond time-based noise and focus on what price is actually doing - moving in significant, measurable amounts that matter for trading decisions.
What is a Trend Reversal (TREV) Chart?
A Trend Reversal chart, also known as a Point & Figure chart variation, is a unique charting method that focuses on price movement thresholds rather than time intervals. Unlike traditional candlestick charts where each candle represents a fixed time period, TREV candles form only when price moves by predefined amounts in ticks.
TREV charts eliminate time-based noise and focus purely on significant price movements, making them ideal for identifying genuine trend changes and continuation patterns.
How TREV Candles Work
This indicator implements true TREV logic with two critical thresholds:
- Trend Size: The number of ticks price must move in the current direction to form a trend continuation candle
- Reversal Size: The number of ticks price must move against the current direction to form a reversal candle and change the overall trend direction
Key TREV Rules Enforced:
- Direction Changes Only Through Reversals: You cannot go from bullish trend directly to bearish trend - a reversal candle must occur first
- Threshold-Based Formation: Candles form only when price thresholds are breached, not on time
- Logical Wick Placement: Wicks only appear on the "open" side of candles where price temporarily moved against the formation direction
- Multiple Candles Per Bar: When price moves significantly, several TREV candles can form within a single time-based bar
Four Distinct Candle Types
- Bullish Trend (Green): Continues upward movement when trend threshold is hit
- Bearish Trend (Red): Continues downward movement when trend threshold is hit
- Bullish Reversal (Blue): Changes from bearish to bullish direction when reversal threshold is breached
- Bearish Reversal (Orange): Changes from bullish to bearish direction when reversal threshold is breached
Practical Trading Applications
- Trend Identification: Clear visual representation of when trends are continuing vs. reversing
- Noise Reduction: Filters out insignificant price movements that don't meet threshold requirements
- Support/Resistance: TREV levels often act as significant support and resistance zones
- Breakout Confirmation: When price forms multiple trend candles in succession, it confirms strong directional movement
- Reversal Signals: Reversal candles provide early warning of potential trend changes
Technical Implementation Features
- Intelligent Price Path Processing: Analyzes the assumed price path within each bar (Low→High→Close for bullish bars, High→Low→Close for bearish bars)
- Automatic Tick Size Detection: Works with any instrument by automatically detecting the correct tick size
- Manual Override Option: Allows manual tick size specification for custom analysis
- Impossible Scenario Prevention: Built-in logic prevents impossible wick configurations and direction changes
- PineScript Optimization: Efficient state management and drawing limits handling for smooth performance
Comprehensive Styling Options
Each of the four candle types offers complete visual customization:
- Body Colors: Independent color settings for each candle type's body
- Border Colors: Separate border color customization
- Border Styles: Choose from solid, dashed, or dotted borders
- Wick Colors: Individual wick color settings for each candle type
Default Color Scheme:
- 🟢 Bullish Trend: Green body and wicks
- 🔵 Bullish Reversal: Blue body and wicks
- 🔴 Bearish Trend: Red body and wicks
- 🟠 Bearish Reversal: Orange body and wicks
Configuration Guidelines
- Trend Size: Larger values create fewer, more significant trend candles. Smaller values increase sensitivity
- Reversal Size: Should typically be smaller than trend size. Controls how easily the trend direction can change
- Tick Size: Use "auto" for most instruments. Manual override useful for custom point values or backtesting
Ideal Use Cases
- Swing Trading: Identify major trend changes and continuation patterns
- Scalping: Use smaller thresholds to catch quick reversals and momentum shifts
- Position Trading: Use larger thresholds to filter noise and focus on major trend moves
- Multi-Timeframe Analysis: Compare TREV patterns across different threshold settings
- Support/Resistance Trading: TREV close levels often become significant price zones
Why This Implementation is Superior
- True TREV Logic: Enforces proper trend reversal rules that many implementations ignore
- No Impossible Scenarios: Prevents wicks on both sides of candles and impossible direction changes
- Professional Visualization: Clean, customizable appearance suitable for serious analysis
- Performance Optimized: Handles large datasets without lag or drawing limit issues
- Educational Value: Helps traders understand the difference between time-based and threshold-based charting
Perfect for traders who want to see beyond time-based noise and focus on what price is actually doing - moving in significant, measurable amounts that matter for trading decisions.
Release Notes
- Upgraded to v6Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.