Open Close Trend Change

This indicator identifies potential trend reversal points based on the Close-Open Gap methodology. It detects specific two-candle patterns followed by a confirmation candle that breaks a key gap level, signaling a potential trend change. The indicator also provides visual confirmation signals when follow-through occurs.
What is a Trend Change?
A Trend Change occurs when:
- Two consecutive candles of the same color form a specific pattern
- No additional pattern repetition occurs afterward
- A candle in the opposite direction closes beyond the gap level
- Optional: The next candle confirms the move with a wick touching the level
This creates a Close-Open Gap between the two setup candles that acts as a critical decision level.
Pattern Rules
Long Trend Change (Bullish Reversal)
Setup Requirements:
- Two consecutive down-close candles (close < open)
- Second candle must make a lower low AND lower high than the first candle
- No additional qualifying two-candle sequence follows immediately
Gap Level: Close price of the first candle
Confirmation: An up-close candle (close > open) closes above the gap level
Follow-Through Confirmation (Green Triangle):
- The candle immediately after the gap break closes above the gap level
- The wick (low) of this candle touches or goes below the gap level (testing support)
Short Trend Change (Bearish Reversal)
Setup Requirements:
- Two consecutive up-close candles (close > open)
- Second candle must make a higher high AND higher low than the first candle
- No additional qualifying two-candle sequence follows immediately
Gap Level: Close price of the first candle
Confirmation: A down-close candle (close < open) closes below the gap level
Follow-Through Confirmation (Red Triangle):
- The candle immediately after the gap break closes below the gap level
- The wick (high) of this candle touches or goes above the gap level (testing resistance)
Key Features
- Multi-Timeframe Support: Calculate trend changes on any timeframe while viewing on your preferred chart timeframe
- Customizable Lookback: Adjust how far back the indicator searches for patterns
- Visual Clarity: Distinct colors for bullish (green) and bearish (red) trend changes
- Confirmation Triangles: Visual indicators when follow-through occurs with proper level retest
- Selective Display: Toggle long or short signals on/off independently
- Extended Lines: Optional line extension to track levels into the future
- Smart Pattern Recognition: Automatically filters out superseded patterns when multiple setups occur in sequence
Parameters
SETTINGS
- Bars Lookback (default: 50): Number of bars to analyze for trend change patterns
- Timeframe (default: Daily): Timeframe used for pattern detection
VISUAL SETTINGS
- Show Long Trend Changes: Display bullish reversal signals
- Show Short Trend Changes: Display bearish reversal signals
- Long TC Color: Color for long trend change lines (default: green)
- Short TC Color: Color for short trend change lines (default: red)
- Line Width: Thickness of trend change lines
- Extend Lines Right: Extend lines to the right edge of the chart
- Show Confirmation Triangles: Display triangles when follow-through confirmation occurs
Understanding Confirmation Triangles
The confirmation triangles are a powerful feature that identifies high-probability setups:
Why They Matter:
When the candle after a gap break closes in the same direction AND retests the level with its wick, it demonstrates:
- Commitment: Market participants are willing to continue in the new direction
- Support/Resistance: The gap level is now acting as support (long) or resistance (short)
- Validation: The level has been successfully flipped
Visual Indicators:
- Green Triangle (pointing up): Appears below bullish follow-through candles
- Red Triangle (pointing down): Appears above bearish follow-through candles
- Triangles only appear when both close and wick conditions are met
Trading Application
The Close-Open Gap acts as a decision level where price previously showed commitment to a direction. When this gap is broken by a candle closing on the opposite side, it suggests:
- Previous directional momentum has weakened
- Market participants are willing to push through the gap
- A potential shift in short-term trend direction
- When confirmed with a triangle: Higher probability of continuation
Example Use Cases
Long Trend Change:
- Wait for two down-close candles forming lower lows (red line appears)
- Enter long when up-close candle breaks above the gap
- Stronger signal: Green triangle appears when next candle retests and closes above
- Use gap level as initial stop-loss reference
- Consider tighter stops when confirmation triangle is present
Short Trend Change:
- Wait for two up-close candles forming higher highs (red line appears)
- Enter short when down-close candle breaks below the gap
- Stronger signal: Red triangle appears when next candle retests and closes below
- Use gap level as initial stop-loss reference
- Consider tighter stops when confirmation triangle is present
Pattern Recognition Logic
Rolling Window Approach:
When three or more consecutive same-colored candles occur, the indicator uses only the last two qualifying candles as the setup. This ensures:
- Only the most recent pattern is considered
- Earlier setups in a continuous sequence are automatically superseded
- Reduced chart clutter from redundant signals
Example: If you see 4 consecutive down-close candles where each makes lower lows and lower highs, only the gap between the last two will be marked.
Important Notes
- Lines without triangles indicate basic trend change setups
- Lines with triangles indicate confirmed setups with follow-through
- Confirmation triangles appear only when specific wick and close conditions are met
- Not all gap breaks will generate confirmation triangles
- Trend changes indicate potential reversals but are not guaranteed
- Always combine with other technical analysis tools and proper risk management
- Consider overall market context and trend direction
- Works best when aligned with higher timeframe trend structure
How It Works
The indicator continuously monitors the selected timeframe for valid two-candle patterns. The process:
- Scans for two consecutive same-colored candles meeting specific criteria
- Filters out patterns that are immediately followed by another qualifying setup
- Draws a horizontal line at the gap level (close of first candle)
- Monitors for a candle closing beyond the gap in the opposite direction
- Checks the following candle for confirmation (close + wick retest)
- Displays a triangle when full confirmation occurs
Best Practices
- Use confirmation triangles as higher-confidence entry signals
- Combine with volume analysis for additional confirmation
- Consider multiple timeframes: gaps on higher timeframes often more significant
- Watch for confluence with other support/resistance levels
- Gaps that align with round numbers or key levels tend to be more reliable
- Monitor how price behaves after the confirmation triangle appears
Disclaimer
This indicator is a pattern recognition tool for educational purposes. It does not predict future price movements and should be used as part of a comprehensive trading strategy with proper risk management. Past performance does not guarantee future results. Confirmation signals improve probability but do not eliminate risk.
สคริปต์แบบเฉพาะผู้ได้รับเชิญเท่านั้น
เฉพาะผู้ใช้งานที่ผู้เขียนอนุมัตเท่านั้นจึงจะสามารถเข้าถึงสคริปต์นี้ได้ คุณจะต้องขอและได้รับอนุญาตก่อนใช้งาน ซึ่งโดยทั่วไปจะได้รับอนุญาตหลังจากชำระเงินแล้ว สำหรับรายละเอียดเพิ่มเติม โปรดทำตามคำแนะนำของผู้เขียนด้านล่าง หรือติดต่อ trading-guide โดยตรง
TradingView ไม่แนะนำให้จ่ายเงินหรือใช้สคริปต์ เว้นแต่คุณจะเชื่อถือผู้เขียนและเข้าใจวิธีการทำงานของสคริปต์นั้นอย่างถ่องแท้ คุณยังสามารถหาทางเลือกแบบโอเพนซอร์สฟรีได้ใน สคริปต์ชุมชนของเรา
คำแนะนำของผู้เขียน
คำจำกัดสิทธิ์ความรับผิดชอบ
สคริปต์แบบเฉพาะผู้ได้รับเชิญเท่านั้น
เฉพาะผู้ใช้งานที่ผู้เขียนอนุมัตเท่านั้นจึงจะสามารถเข้าถึงสคริปต์นี้ได้ คุณจะต้องขอและได้รับอนุญาตก่อนใช้งาน ซึ่งโดยทั่วไปจะได้รับอนุญาตหลังจากชำระเงินแล้ว สำหรับรายละเอียดเพิ่มเติม โปรดทำตามคำแนะนำของผู้เขียนด้านล่าง หรือติดต่อ trading-guide โดยตรง
TradingView ไม่แนะนำให้จ่ายเงินหรือใช้สคริปต์ เว้นแต่คุณจะเชื่อถือผู้เขียนและเข้าใจวิธีการทำงานของสคริปต์นั้นอย่างถ่องแท้ คุณยังสามารถหาทางเลือกแบบโอเพนซอร์สฟรีได้ใน สคริปต์ชุมชนของเรา