OPEN-SOURCE SCRIPT
ที่อัปเดต:

Session Breakout, Retest, Reversal + Large Move Alert

1 421
## **Session Breakout, Retest, Reversal + Large Move Alert**

### Overview

A powerful multi-functional indicator designed for day traders and futures traders to identify session-based breakout opportunities, retest confirmations, and significant price movements across all futures contracts (Gold, E-mini S&P 500, Nasdaq, Crude Oil, and more).

### Key Features

**📊 Pre-Market Session Tracking**
- Automatically calculates pre-market/overnight session highs and lows
- Displays session ranges with customizable colors and styling
- Extends lines through the entire trading session for easy reference
- Supports overnight sessions (e.g., 4 PM – 7:30 AM for Gold futures)

**🚀 Breakout Detection**
- Identifies breakouts above/below pre-market highs and lows
- Uses close-price confirmation to filter false signals from wicks
- Displays "BO ↑" and "BO ↓" labels at breakout points
- Generates instant alerts when breakouts occur

**♻️ Retest Failed Tracking**
- Monitors price retests after breakouts
- Detects when retests fail to reach previous support/resistance
- Labels "RF" (Retest Failed) for high-probability trade setups
- Helps identify reversal opportunities

**📈 First 5-Minute Analysis**
- Captures first 5 minutes of market open (customizable timeframe)
- Tracks first 5-minute highs and lows separately
- Essential for mean-reversion and breakout confirmation strategies
- Blue lines extend through the trading session for easy tracking

**⚡ Large Move Alerts**
- Detects significant price movements based on point thresholds
- Individual thresholds for 5+ different symbols:
- GC (Gold): 15 points
- ES (E-mini S&P 500): 15 points
- NQ (E-mini Nasdaq): 50 points
- CL (Crude Oil): 1.5 points
- Custom: Fully adjustable
- Auto-detects symbol from chart ticker
- Labels show exact point movement and candle direction

### Customization Options

**Symbol Configuration**
- **Auto-Mode**: Automatically detects trading symbol from chart ticker
- **Manual-Mode**: Select specific symbol (GC, ES, NQ, CL, or Custom)

**Session Settings**
- Fully customizable pre-market session time (24-hour format)
- Adjustable market open time for first 5-minute window
- Market close hour and minute configuration
- Support for any timezone

**Point Move Thresholds by Symbol**
- Set independent thresholds for each of your trading symbols
- Quickly adjust settings when switching between different futures
- Includes helpful tooltips for recommended values

**Display & Styling**
- Toggle all visual elements on/off individually
- Customizable colors for all lines and labels:
- Pre-market high/low colors
- Breakout labels (up/down)
- Retest failed labels
- First 5-minute session lines
- Large move indicators
- Text size options: tiny, small, normal, large, huge

### How It Works

1. **Session Tracking**: The indicator identifies your pre-market session and marks the high and low with labeled lines (PH/PL)

2. **Breakout Signal**: Once the market opens, it monitors for close prices above/below the pre-market levels and alerts you with "BO ↑" or "BO ↓"

3. **Retest Confirmation**: After a breakout, it tracks retests and labels "RF" when the retest fails to reach the opposite extreme, confirming trade direction

4. **Large Move Detection**: Simultaneously monitors for significant point moves that exceed your symbol-specific thresholds

5. **Alert Triggers**: Get real-time alerts for:
- Breakout Up/Down
- Any Breakout
- Large Move events

### Alert Conditions

The indicator includes four alert conditions:
- **Breakout Up Alert**: Price closes above pre-market high
- **Breakout Down Alert**: Price closes below pre-market low
- **Any Breakout Alert**: Either breakout condition triggers
- **Large Move Alert**: Point movement exceeds threshold for current symbol

### Ideal For

- ✅ Day traders (breakout/retest strategies)
- ✅ Futures traders (Gold, Oil, Stock Index Contracts)
- ✅ Intraday scalpers (first 5-minute analysis)
- ✅ Swing traders (session-based levels)
- ✅ Multi-symbol traders (independent thresholds per symbol)

### Disclaimer

This indicator is designed for educational and informational purposes. Past performance does not guarantee future results. Always use proper risk management and position sizing. Test thoroughly on historical data before trading live.
เอกสารเผยแพร่
New version with minor fixes.
เอกสารเผยแพร่
Below is a concise summary of the changes needed before you publish the script on TradingView. These adjustments address the problems you encountered (GC/ES thresholds not working properly and “Auto” mode confusion) and ensure the indicator compiles cleanly with only one declaration:

## 1. Manual Symbol Selection Uses Custom Threshold Only

* **Removed the “Auto” mode for manual symbol input.** The `Manual Symbol Selection` field is now a free‑text input where you can type any symbol.
* **Custom threshold mapping.** Whatever you type in this field will always use **threshold_symbol5** (Custom). It will never override or interfere with the GC/ES/NQ/CL thresholds.

## 2. Automatic Threshold Detection Restored

* **New `f_getActiveSymbol()` function.** This function looks at the chart’s ticker (`syminfo.ticker`) and automatically selects “GC”, “ES”, “NQ” or “CL” if those substrings appear. If none of those tickers are present (e.g. YM or any other), it falls back to whatever you typed in Manual Symbol Selection.
* **New `f_getThreshold()` function.** Based on `active_symbol`, it returns the corresponding threshold:

* `GC` → `threshold_symbol1`
* `ES` → `threshold_symbol2`
* `NQ` → `threshold_symbol3`
* `CL` → `threshold_symbol4`
* Anything else → `threshold_symbol5`
* This ensures that, for example, on a GC chart the script uses the GC threshold automatically—even if Manual Symbol Selection is set to something unrelated.

## 3. Single Indicator Declaration

* **Only one call to `indicator()`** is present at the top of the script. If you previously pasted multiple versions into the editor, be sure to clear them out before publishing.

## 4. Publishing Steps

1. Open a new blank Pine Script in TradingView’s Pine Editor.
2. Paste the entire updated script (provided in the previous message or via the downloadable file).
3. Save the script and click “Add to Chart” to verify it compiles without errors and displays correctly.
4. Once verified, click on the “Publish Script” button, fill out the name/description as desired, and publish it publicly or privately.

By following these steps and using the updated logic, the GC threshold will work automatically on GC charts, the manual field will apply only to custom symbols, and there will be no confusion between Symbol 1 (GC) and Symbol 5 (custom).

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน