Divergence Screener [Trendoscope®]🎲Overview
The Divergence Screener is a powerful TradingView indicator designed to detect and visualize bullish and bearish divergences, including hidden divergences, between price action and a user-selected oscillator. Built with flexibility in mind, it allows traders to customize the oscillator type, trend detection method, and other parameters to suit various trading strategies. The indicator is non-overlay, displaying divergence signals directly on the oscillator plot, with visual cues such as lines and labels on the chart for easy identification.
This indicator is ideal for traders seeking to identify potential reversal or continuation signals based on price-oscillator divergences. It supports multiple oscillators, trend detection methods, and alert configurations, making it versatile for different markets and timeframes.
🎲Features
🎯Customizable Oscillator Selection
Built-in Oscillators : Choose from a variety of oscillators including RSI, CCI, CMO, COG, MFI, ROC, Stochastic, and WPR.
External Oscillator Support : Users can input an external oscillator source, allowing integration with custom or third-party indicators.
Configurable Length : Adjust the oscillator’s period (e.g., 14 for RSI) to fine-tune sensitivity.
🎯Divergence Detection
The screener identifies four types of divergences:
Bullish Divergence : Price forms a lower low, but the oscillator forms a higher low, signaling potential upward reversal.
Bearish Divergence : Price forms a higher high, but the oscillator forms a lower high, indicating potential downward reversal.
Bullish Hidden Divergence : Price forms a higher low, but the oscillator forms a lower low, suggesting trend continuation in an uptrend.
Bearish Hidden Divergence : Price forms a lower high, but the oscillator forms a higher high, suggesting trend continuation in a downtrend.
🎯Flexible Trend Detection
The indicator offers three methods to determine the trend context for divergence detection:
Zigzag : Uses zigzag pivots to identify trends based on higher highs (HH), higher lows (HL), lower highs (LH), and lower lows (LL).
MA Difference : Calculates the trend based on the difference in a moving average (e.g., SMA, EMA) between divergence pivots.
External Trend Signal : Allows users to input an external trend signal (positive for uptrend, negative for downtrend) for custom trend analysis.
🎯Zigzag-Based Pivot Analysis
Customizable Zigzag Length : Adjust the zigzag length (default: 13) to control the sensitivity of pivot detection.
Repaint Option : Choose whether divergence lines repaint based on the latest data or wait for confirmed pivots, balancing responsiveness and reliability.
🎯Visual and Alert Features
Divergence Visualization : Divergence lines are drawn between price pivots and oscillator pivots, color-coded for easy identification:
Bullish Divergence : Green
Bearish Divergence : Red
Bullish Hidden Divergence : Lime
Bearish Hidden Divergence : Orange
Labels and Tooltips : Labels (e.g., “D” for divergence, “H” for hidden) appear on price and oscillator pivots, with tooltips providing detailed information such as price/oscillator values, ratios, and pivot directions.
Alerts : Configurable alerts for each divergence type (bullish, bearish, bullish hidden, bearish hidden) trigger on bar close, ensuring timely notifications.
🎲 How It Works
🎯Oscillator Calculation
The indicator calculates the selected oscillator (or uses an external source) and plots it on the chart.
Oscillator values are stored in a map for reference during divergence calculations.
🎯Pivot Detection
A zigzag algorithm identifies pivots in the oscillator data, with configurable length and repainting options.
Price and oscillator pivots are compared to detect divergences based on their direction and ratio.
🎯Divergence Identification
The indicator compares price and oscillator pivot directions (HH, HL, LH, LL) to identify divergences.
Trend context is determined using the selected method (Zigzag, MA Difference, or External).
Divergences are classified as bullish, bearish, bullish hidden, or bearish hidden based on price-oscillator relationships and trend direction.
🎯Visualization and Alerts
Valid divergences are drawn as lines connecting price and oscillator pivots, with corresponding labels.
Alerts are triggered for allowed divergence types, providing detailed information via tooltips.
🎯Validation
Divergence lines are validated to ensure no intermediate bars violate the divergence condition, enhancing signal reliability.
🎲 Usage Instructions as Indicator
🎯Add to Chart:
Add the “Divergence Screener ” to your TradingView chart.
The indicator appears in a separate pane below the price chart, plotting the oscillator and divergence signals.
🎯Configure Settings:
Adjust the oscillator type and length to match your trading style.
Select a trend detection method and configure related parameters (e.g., MA type/length or external signal).
Set the zigzag length and repainting preference.
Enable/disable alerts for specific divergence types.
I🎯nterpret Signals:
Bullish Divergence (Green) : Look for potential buy opportunities in a downtrend.
Bearish Divergence (Red) : Consider sell opportunities in an uptrend.
Bullish Hidden Divergence (Lime) : Confirm continuation in an uptrend.
Bearish Hidden Divergence (Orange): Confirm continuation in a downtrend.
Use tooltips on labels to review detailed pivot and divergence information.
🎯Set Alerts:
Create alerts for each divergence type to receive notifications via TradingView’s alert system.
Alerts include detailed text with price, oscillator, and divergence information.
🎲 Example Scenarios as Indicator
🎯 With External Oscillator (Use MACD Histogram as Oscillator)
In order to use MACD as an oscillator for divergence signal instead of the built in options, follow these steps.
Load MACD Indicator from Indicator library
From Indicator settings of Divergence Screener, set Use External Oscillator and select MACD Histograme from the dropdown
You can now see that the oscillator pane shows the data of selected MACD histogram and divergence signals are generated based on the external MACD histogram data.
🎯 With External Trend Signal (Supertrend Ladder ATR)
Now let's demonstrate how to use external direction signals using Supertrend Ladder ATR indicator. Please note that in order to use the indicator as trend source, the indicator should return positive integer for uptrend and negative integer for downtrend. Steps are as follows:
Load the desired trend indicator. In this example, we are using Supertrend Ladder ATR
From the settings of Divergence Screener, select "External" as Trend Detection Method
Select the trend detection plot Direction from the dropdown. You can now see that the divergence signals will rely on the new trend settings rather than the built in options.
🎲 Using the Script with Pine Screener
The primary purpose of the Divergence Screener is to enable traders to scan multiple instruments (e.g., stocks, ETFs, forex pairs) for divergence signals using TradingView’s Pine Screener, facilitating efficient comparison and identification of trading opportunities.
To use the Divergence Screener as a screener, follow these steps:
Add to Favorites : Add the Divergence Screener to your TradingView favorites to make it available in the Pine Screener.
Create a Watchlist : Build a watchlist containing the instruments (e.g., stocks, ETFs, or forex pairs) you want to scan for divergences.
Access Pine Screener : Navigate to the Pine Screener via TradingView’s main menu: Products -> Screeners -> Pine, or directly visit tradingview.com/pine-screener/.
Select Watchlist : Choose the watchlist you created from the Watchlist dropdown in the Pine Screener interface.
Choose Indicator : Select Divergence Screener from the Choose Indicator dropdown.
Configure Settings : Set the desired timeframe (e.g., 1 hour, 1 day) and adjust indicator settings such as oscillator type, zigzag length, or trend detection method as needed.
Select Filter Criteria : Select the condition on which the watchlist items needs to be filtered. Filtering can only be done on the plots defined in the script.
Run Scan : Press the Scan button to display divergence signals across the selected instruments. The screener will show which instruments exhibit bullish, bearish, bullish hidden, or bearish hidden divergences based on the configured settings.
🎲 Limitations and Possible Future Enhancements
Limitations are
Custom input for oscillator and trend detection cannot be used in pine screener.
Pine screener has max 500 bars available.
Repaint option is by default enabled. When in repaint mode expect the early signal but the signals are prone to repaint.
Possible future enhancements
Add more built-in options for oscillators and trend detection methods so that dependency on external indicators is limited
Multi level zigzag support
Chart patterns
Market Killer & Scalper [SUKH-X] [Only 1% can understand it]Advanced XAUUSD Scalper Pro - Complete Trading System
🎯 Overview
The Advanced XAUUSD Scalper Pro is a comprehensive Pine Script indicator specifically designed for scalping XAUUSD (Gold/USD) on 5-minute timeframes. This professional-grade tool combines multiple technical analysis methods to provide high-accuracy entry and exit signals for short-term traders.
🔧 Core Features
Dynamic Support & Resistance System
Automatic Pivot Detection : Identifies key pivot highs and lows based on customizable strength settings
Visual S&R Boxes : Color-coded boxes highlighting support (green) and resistance (red) zones
Adaptive Levels : Maintains up to 10 dynamic S&R levels that update in real-time
Breakout Detection : Alerts when price breaks through significant levels with volume confirmation
Advanced Breakout Analysis [ /i]
Threshold-Based Detection : Customizable breakout percentage thresholds (default 0.02%)
Volume Confirmation : Optional volume spike validation for stronger signals
Consolidation Zones : Identifies sideways markets before potential breakouts
Multi-Timeframe Support : Works across different timeframes with adaptive parameters
### **Reversal Signal System**
- **RSI Integration**: 14-period RSI with customizable overbought (70) and oversold (30) levels
- **Stochastic Oscillator**: Dual %K and %D lines for momentum confirmation
- **Candlestick Patterns**: Incorporates bullish/bearish candlestick analysis
- **Divergence Detection**: Identifies potential trend reversals at key levels
### **Scalping Optimization**
- **Dual EMA System**: Fast EMA (8) and Slow EMA (21) for trend direction
- **ATR-Based Calculations**: Dynamic stop-loss and take-profit levels using Average True Range
- **Trend Strength Filter**: Background coloring indicates strong uptrends (green) and downtrends (red)
- **Noise Reduction**: Filters out false signals in choppy market conditions
## 📊 **Visual Elements**
### **Signal Types**
- **🟢 Green Triangle Up**: Long entry signal with confluence of bullish factors
- **🔴 Red Triangle Down**: Short entry signal with bearish confirmation
- **🟡 Yellow X**: Exit signals for both long and short positions
- **Blue/Orange Lines**: Fast and slow EMAs for trend visualization
### **Information Dashboard**
- **Real-Time Statistics**: Live price, ATR, RSI, trend direction, and volume status
- **S&R Level Counter**: Shows active support and resistance levels
- **Consolidation Indicator**: Identifies low-volatility periods
- **Market Condition**: Current trend strength and direction
## ⚙️ **Customizable Parameters**
### **Support & Resistance Settings**
- S&R Period: 5-100 (default: 20)
- S&R Strength: 1-5 (default: 2)
- Maximum S&R Levels: 3-10 (default: 5)
- Visual box display toggle
### **Breakout Configuration**
- Breakout threshold: 0.01%-0.1% (default: 0.02%)
- Volume confirmation on/off
- Minimum consolidation bars: 5-50 (default: 10)
### **Reversal Settings**
- RSI period: 2-50 (default: 14)
- Overbought/oversold levels: customizable
- Stochastic %K and %D periods
### **Scalping Parameters**
- Fast EMA: 3-20 (default: 8)
- Slow EMA: 10-50 (default: 21)
- ATR period and multiplier for risk management
## 🚀 **Best Practices**
### **Optimal Setup**
- **Timeframe**: 5-minute charts (can be adapted for 1m, 3m, 15m)
- **Instrument**: XAUUSD (Gold/USD) - specifically optimized for gold volatility
- **Session**: Best during London and New York overlaps
- **Market Conditions**: Most effective in trending and breakout scenarios
### **Risk Management**
- Use ATR multiplier (1.5x default) for stop-loss placement
- Take profit at 2:1 or 3:1 risk-reward ratios
- Enable volume confirmation for higher-probability trades
- Monitor news events that affect gold prices
### **Signal Interpretation**
- **Strong Signals**: Multiple confirmations (trend + S&R + momentum)
- **Weak Signals**: Single indicator signals during consolidation
- **Exit Strategy**: Use yellow X markers or when price hits opposite EMA
## 📈 **Performance Features**
### **Accuracy Enhancements**
- **Multi-Confirmation System**: Requires multiple technical factors to align
- **False Signal Filtering**: Reduces noise through trend and volume filters
- **Adaptive Levels**: S&R levels update based on recent price action
- **Market Structure Analysis**: Considers overall market context
### **Alert System**
- **Entry Alerts**: Long and short signal notifications
- **Exit Alerts**: Position closure recommendations
- **Level Alerts**: S&R breakout notifications
- **Custom Messages**: Detailed alert information including price and ATR
## 🎨 **Visual Customization**
- Toggle all visual elements on/off
- Customizable colors and transparency
- Adjustable line widths and styles
- Statistics table positioning
- Background coloring for trend identification
## 📋 **Technical Requirements**
- Pine Script v5 compatible
- Maximum 500 boxes and lines for optimal performance
- Real-time data feed recommended
- Works on TradingView Pro, Pro+, and Premium plans
## 🔍 **Unique Selling Points**
1. **XAUUSD Specific**: Optimized parameters for gold's unique volatility patterns
2. **Scalping Focus**: Designed for quick entries and exits with minimal lag
3. **Complete System**: Combines trend, momentum, and S&R analysis
4. **Professional Grade**: Institutional-quality technical analysis
5. **User-Friendly**: Intuitive visual signals with comprehensive customization
## ⚠️ **Disclaimer**
This indicator is a technical analysis tool designed to assist in trading decisions. It should not be used as the sole basis for trading decisions. Always combine with proper risk management, fundamental analysis, and market awareness. Past performance does not guarantee future results. Trading gold (XAUUSD) involves substantial risk and may not be suitable for all investors.
## 🏷️ **Tags**
`XAUUSD` `Gold` `Scalping` `Support` `Resistance` `Breakout` `Reversal` `EMA` `RSI` `Stochastic` `ATR` `Volume` `Alerts` `5min` `Intraday`
[TH] กลยุทธ์ SMC หลายกรอบเวลา (V5.2 - M15 Lead)English Explanation
This Pine Script code implements a multi-timeframe trading strategy based on Smart Money Concepts (SMC). It's designed to identify high-probability trading setups by aligning signals across three different timeframes.
The core logic is as follows:
High Timeframe (HTF) - M15: Determines the overall market direction or bias.
Medium Timeframe (MTF) - M5: Identifies potential Points of Interest (POI), such as Order Blocks or Fair Value Gaps, in alignment with the M15 bias.
Low Timeframe (LTF) - Current Chart: Looks for a specific entry trigger within the M5 POI to execute the trade.
Detailed Breakdown
## Part 1: Inputs & Settings
This section allows you to customize the indicator's parameters:
General Settings:
i_pivotLookback: Sets the lookback period for identifying pivot highs and lows on the LTF, which is crucial for finding the Change of Character (CHoCH).
M15 Bias Settings:
i_m15EmaFast / i_m15EmaSlow: These two EMA (Exponential Moving Average) values on the 15-minute chart determine the main trend. A bullish trend is confirmed when the fast EMA is above the slow EMA, and vice-versa for a bearish trend.
M5 Point of Interest (POI) Settings:
i_showM5Fvg / i_showM5Ob: Toggles the visibility of Fair Value Gaps (FVG) and Order Blocks (OB) on the 5-minute chart. These are the zones where the script will look for trading opportunities.
i_maxPois: Limits the number of POI zones drawn on the chart to keep it clean.
LTF Entry Settings:
i_entryMode:
Confirmation: The script waits for a Change of Character (CHoCH) on the LTF (your current chart) after the price enters an M5 POI. A CHoCH is a break of a recent pivot high (for buys) or pivot low (for sells), suggesting a potential reversal. This is the safer entry method.
Aggressive: The script triggers an entry as soon as the price touches the 50% level of the M5 POI, without waiting for a CHoCH. This is higher risk but can provide a better entry price.
i_showChoch: Toggles the visibility of the CHoCH confirmation lines.
Trade Management Settings:
i_tpRatio: Sets the Risk-to-Reward Ratio (RRR) for the Take Profit target. For example, a value of 2.0 means the Take Profit distance will be twice the Stop Loss distance.
i_slMode: (New in V5.2) Provides four different methods to calculate the Stop Loss:
POI Zone (Default): Places the SL at the outer edge of the M5 POI zone.
Last Swing: Places the SL at the most recent LTF swing high/low before the entry.
ATR: Uses the Average True Range (ATR) indicator to set a volatility-based SL.
Previous Candle: Places the SL at the high or low of the candle immediately preceding the entry. This is the tightest and riskiest option.
i_maxHistory: Sets the number of past trades to display on the chart.
## Part 2: Data Types & Variables
This section defines custom data structures (type) to organize information:
Poi: A structure to hold all information related to a single Point of Interest, including its price boundaries, direction (bullish/bearish), and whether it has been mitigated (touched by price).
Trade: A structure to store details for each trade, such as its entry price, SL, TP, result (Win/Loss/Active), and chart objects for drawing.
## Part 3: Core Logic & Calculations
This is the engine of the indicator:
Data Fetching: It uses request.security to pull EMA data from the M15 timeframe and candle data (high, low, open, close) from the M5 timeframe.
POI Identification: The script constantly scans the M5 data for FVG and OB patterns. When a valid pattern is found that aligns with the M15 bias (e.g., a bullish OB during an M15 uptrend), it's stored as a Poi and drawn on the chart.
Entry Trigger:
It checks if the price on the LTF enters a valid (unmitigated) POI zone.
Based on the selected i_entryMode, it either waits for a CHoCH or enters aggressively.
Once an entry condition is met, it calculates the SL based on the i_slMode, calculates the TP using the i_tpRatio, and creates a new Trade.
Trade Monitoring: For every active trade, the script checks on each new bar if the price has hit the SL or TP level. When it does, the trade's result is updated, and the visual boxes are finalized.
## Part 5: On-Screen Display
This part creates the Performance Dashboard table shown on the top-right of the chart. It provides a real-time summary of:
M15 Bias: Current market direction.
Total Trades: The total number of completed trades from the history.
Win Rate: The percentage of winning trades.
Total R-Multiple: The cumulative Risk-to-Reward multiple (sum of RRR from wins minus losses). A positive value indicates overall profitability.
🇹🇭 คำอธิบายและข้อแนะนำภาษาไทย
สคริปต์นี้เป็น Indicator สำหรับกลยุทธ์การเทรดแบบ Smart Money Concepts (SMC) ที่ใช้การวิเคราะห์จากหลายกรอบเวลา (Multi-Timeframe) เพื่อหาจุดเข้าเทรดที่มีความเป็นไปได้สูง
หลักการทำงานของ Indicator มีดังนี้:
Timeframe ใหญ่ (HTF) - M15: ใช้กำหนดทิศทางหลักของตลาด หรือ "Bias"
Timeframe กลาง (MTF) - M5: ใช้หาโซนสำคัญ หรือ "Point of Interest (POI)" เช่น Order Blocks หรือ Fair Value Gaps ที่สอดคล้องกับทิศทางจาก M15
Timeframe เล็ก (LTF) - กราฟปัจจุบัน: ใช้หาสัญญาณยืนยันเพื่อเข้าเทรดในโซน POI ที่กำหนดไว้
รายละเอียดของโค้ด
## ส่วนที่ 1: การตั้งค่า (Inputs & Settings)
ส่วนนี้ให้คุณปรับแต่งค่าต่างๆ ของ Indicator ได้:
การตั้งค่าทั่วไป:
i_pivotLookback: กำหนดระยะเวลาที่ใช้มองหาจุดกลับตัว (Pivot) ใน Timeframe เล็ก (LTF) เพื่อใช้ยืนยันสัญญาณ Change of Character (CHoCH)
การตั้งค่า M15 (ทิศทางหลัก):
i_m15EmaFast / i_m15EmaSlow: ใช้เส้น EMA 2 เส้นบน Timeframe 15 นาที เพื่อกำหนดเทรนด์หลัก หาก EMA เร็วอยู่เหนือ EMA ช้า จะเป็นเทรนด์ขาขึ้น และในทางกลับกัน
การตั้งค่า M5 (จุดสนใจ - POI):
i_showM5Fvg / i_showM5Ob: เปิด/ปิด การแสดงโซน Fair Value Gaps (FVG) และ Order Blocks (OB) บน Timeframe 5 นาที ซึ่งเป็นโซนที่สคริปต์จะใช้หาโอกาสเข้าเทรด
i_maxPois: จำกัดจำนวนโซน POI ที่จะแสดงผลบนหน้าจอ เพื่อไม่ให้กราฟดูรกเกินไป
การตั้งค่า LTF (การเข้าเทรด):
i_entryMode:
ยืนยัน (Confirmation): เป็นโหมดที่ปลอดภัยกว่า โดยสคริปต์จะรอให้เกิดสัญญาณ Change of Character (CHoCH) ใน Timeframe เล็กก่อน หลังจากที่ราคาเข้ามาในโซน POI แล้ว
เชิงรุก (Aggressive): เป็นโหมดที่เสี่ยงกว่า โดยสคริปต์จะเข้าเทรดทันทีที่ราคาแตะระดับ 50% ของโซน POI โดยไม่รอสัญญาณยืนยัน CHoCH
i_showChoch: เปิด/ปิด การแสดงเส้น CHoCH บนกราฟ
การตั้งค่าการจัดการเทรด:
i_tpRatio: กำหนด อัตราส่วนกำไรต่อความเสี่ยง (Risk-to-Reward Ratio) เพื่อตั้งเป้าหมายทำกำไร (Take Profit) เช่น 2.0 หมายถึงระยะทำกำไรจะเป็น 2 เท่าของระยะตัดขาดทุน
i_slMode: (ฟีเจอร์ใหม่ V5.2) มี 4 รูปแบบในการคำนวณ Stop Loss:
โซน POI (ค่าเริ่มต้น): วาง SL ไว้ที่ขอบนอกสุดของโซน POI
Swing ล่าสุด: วาง SL ไว้ที่จุด Swing High/Low ล่าสุดของ Timeframe เล็ก (LTF) ก่อนเข้าเทรด
ATR: ใช้ค่า ATR (Average True Range) เพื่อกำหนด SL ตามระดับความผันผวนของราคา
แท่งเทียนก่อนหน้า: วาง SL ไว้ที่ราคา High/Low ของแท่งเทียนก่อนหน้าที่จะเข้าเทรด เป็นวิธีที่ SL แคบและเสี่ยงที่สุด
i_maxHistory: กำหนดจำนวนประวัติการเทรดที่จะแสดงย้อนหลังบนกราฟ
## ส่วนที่ 2: ประเภทข้อมูลและตัวแปร
ส่วนนี้เป็นการสร้างโครงสร้างข้อมูล (type) เพื่อจัดเก็บข้อมูลให้เป็นระบบ:
Poi: เก็บข้อมูลของโซน POI แต่ละโซน เช่น กรอบราคาบน-ล่าง, ทิศทาง (ขึ้น/ลง) และสถานะว่าถูกใช้งานไปแล้วหรือยัง (Mitigated)
Trade: เก็บรายละเอียดของแต่ละการเทรด เช่น ราคาเข้า, SL, TP, ผลลัพธ์ (Win/Loss/Active) และอ็อบเจกต์สำหรับวาดกล่องบนกราฟ
## ส่วนที่ 3: ตรรกะหลักและการคำนวณ
เป็นหัวใจสำคัญของ Indicator:
ดึงข้อมูลข้าม Timeframe: ใช้ฟังก์ชัน request.security เพื่อดึงข้อมูล EMA จาก M15 และข้อมูลแท่งเทียนจาก M5 มาใช้งาน
ระบุ POI: สคริปต์จะค้นหา FVG และ OB บน M5 ตลอดเวลา หากเจ้ารูปแบบที่สอดคล้องกับทิศทางหลักจาก M15 (เช่น เจอ Bullish OB ในขณะที่ M15 เป็นขาขึ้น) ก็จะวาดโซนนั้นไว้บนกราฟ
เงื่อนไขการเข้าเทรด:
เมื่อราคาใน Timeframe เล็ก (LTF) วิ่งเข้ามาในโซน POI ที่ยังไม่เคยถูกใช้งาน
สคริปต์จะรอสัญญาณตาม i_entryMode ที่เลือกไว้ (รอ CHoCH หรือเข้าแบบ Aggressive)
เมื่อเงื่อนไขครบ จะคำนวณ SL และ TP จากนั้นจึงบันทึกการเทรดใหม่
ติดตามการเทรด: สำหรับเทรดที่ยัง "Active" อยู่ สคริปต์จะคอยตรวจสอบทุกแท่งเทียนว่าราคาไปถึง SL หรือ TP แล้วหรือยัง เมื่อถึงจุดใดจุดหนึ่ง จะบันทึกผลและสิ้นสุดการวาดกล่องบนกราฟ
## ส่วนที่ 5: การแสดงผลบนหน้าจอ
ส่วนนี้จะสร้างตาราง "Performance Dashboard" ที่มุมขวาบนของกราฟ เพื่อสรุปผลการทำงานแบบ Real-time:
M15 Bias: แสดงทิศทางของตลาดในปัจจุบัน
Total Trades: จำนวนเทรดทั้งหมดที่เกิดขึ้นในประวัติ
Win Rate: อัตราชนะ คิดเป็นเปอร์เซ็นต์
Total R-Multiple: ผลตอบแทนรวมจากความเสี่ยง (R) ทั้งหมด (ผลรวม RRR ของเทรดที่ชนะ ลบด้วยจำนวนเทรดที่แพ้) หากเป็นบวกแสดงว่ามีกำไรโดยรวม
📋 ข้อแนะนำในการใช้งาน
Timeframe ที่เหมาะสม: Indicator นี้ถูกออกแบบมาให้ใช้กับ Timeframe เล็ก (LTF) เช่น M1, M3 หรือ M5 เนื่องจากมันดึงข้อมูลจาก M15 และ M5 มาเป็นหลักการอยู่แล้ว
สไตล์การเทรด:
Confirmation: เหมาะสำหรับผู้ที่ต้องการความปลอดภัยสูง รอการยืนยันก่อนเข้าเทรด อาจจะตกรถบ้าง แต่ลดความเสี่ยงจากการเข้าเทรดเร็วเกินไป
Aggressive: เหมาะสำหรับผู้ที่ยอมรับความเสี่ยงได้สูงขึ้น เพื่อให้ได้ราคาเข้าที่ดีที่สุด
การเลือก Stop Loss:
"Swing ล่าสุด" และ "โซน POI" เป็นวิธีมาตรฐานตามหลัก SMC
"ATR" เหมาะกับตลาดที่มีความผันผวนสูง เพราะ SL จะปรับตามสภาพตลาด
"แท่งเทียนก่อนหน้า" เป็นวิธีที่เสี่ยงที่สุด เหมาะกับการเทรดเร็วและต้องการ RRR สูงๆ แต่ก็มีโอกาสโดน SL ง่ายขึ้น
การบริหารความเสี่ยง: Indicator นี้เป็นเพียง เครื่องมือช่วยวิเคราะห์ ไม่ใช่สัญญาณซื้อขายอัตโนมัติ 100% ผู้ใช้ควรมีความเข้าใจในหลักการของ SMC และทำการบริหารความเสี่ยง (Risk Management) อย่างเคร่งครัดเสมอ
การทดสอบย้อนหลัง (Backtesting): ควรทำการทดสอบ Indicator กับสินทรัพย์และตั้งค่าต่างๆ เพื่อให้เข้าใจลักษณะการทำงานและประสิทธิภาพของมันก่อนนำไปใช้เทรดจริง
Enhanced Ichimoku Cloud Strategy V1 [Quant Trading]Overview
This strategy combines the powerful Ichimoku Kinko Hyo system with a 171-period Exponential Moving Average (EMA) filter to create a robust trend-following approach. The strategy is designed for traders seeking to capitalize on strong momentum moves while using the Ichimoku cloud structure to identify optimal entry and exit points.
This is a patient, low-frequency trading system that prioritizes quality over quantity. In backtesting on Solana, the strategy achieved impressive results with approximately 3600% profit over just 29 trades, demonstrating its effectiveness at capturing major trend movements rather than attempting to profit from every market fluctuation. The extended parameters and strict entry criteria are specifically optimized for Solana's price action characteristics, making it well-suited for traders who prefer fewer, higher-conviction positions over high-frequency trading approaches.
What Makes This Strategy Original
This implementation enhances the traditional Ichimoku system by:
Custom Ichimoku Parameters: Uses non-standard periods (Conversion: 7, Base: 211, Lagging Span 2: 120, Displacement: 41) optimized for different market conditions
EMA Confirmation Filter: Incorporates a 171-period EMA as an additional trend confirmation layer
State Memory System: Implements a sophisticated memory system to track buy/sell states and prevent false signals
Dual Trade Modes: Offers both traditional Ichimoku signals ("Ichi") and cloud-based signals ("Cloud")
Breakout Confirmation: Requires price to break above the 25-period high for long entries
How It Works
Core Components
Ichimoku Elements:
-Conversion Line (Tenkan-sen): 7-period Donchian midpoint
-Base Line (Kijun-sen): 211-period Donchian midpoint
-Span A (Senkou Span A): Average of Conversion and Base lines, plotted 41 periods ahead
-Span B (Senkou Span B): 120-period Donchian midpoint, plotted 41 periods ahead
-Lagging Span (Chikou Span): Current close plotted 41 periods back
EMA Filter: 171-period EMA acts as a long-term trend filter
Entry Logic (Ichi Mode - Default)
A long position is triggered when ALL conditions are met:
Cloud Bullish: Span A > Span B (41 periods ago)
Breakout Confirmation: Current close > 25-period high
Ichimoku Bullish: Conversion Line > Base Line
Trend Alignment: Current close > 171-period EMA
State Memory: No previous buy signal is still active
Exit Logic
Positions are closed when:
Ichimoku Bearish: Conversion Line < Base Line
Alternative Cloud Mode
When "Cloud" mode is selected, the strategy uses:
Entry: Span A crosses above Span B with additional cloud and EMA confirmations
Exit: Span A crosses below Span B with cloud and EMA confirmations
Default Settings Explained
Strategy Properties
Initial Capital: $1,000 (realistic for average traders)
Position Size: 100% of equity (appropriate for backtesting single-asset strategies)
Commission: 0.1% (realistic for most brokers)
Slippage: 3 ticks (accounts for realistic execution costs)
Date Range: January 1, 2018 to December 31, 2069
Key Parameters
Conversion Periods: 7 (faster than traditional 9, more responsive to price changes)
Base Periods: 211 (much longer than traditional 26, provides stronger trend confirmation)
Lagging Span 2 Periods: 120 (custom period for stronger support/resistance levels)
Displacement: 41 (projects cloud further into future than standard 26)
EMA Period: 171 (long-term trend filter, approximately 8.5 months of daily data)
How to Use This Strategy
Best Market Conditions
Trending Markets: Works best in clearly trending markets where the cloud provides strong directional bias
Medium to Long-term Timeframes: Optimized for daily charts and higher timeframes
Volatile Assets: The breakout confirmation helps filter out weak signals in choppy markets
Risk Management
The strategy uses 100% equity allocation, suitable for backtesting single strategies
Consider reducing position size when implementing with real capital
Monitor the 25-period high breakout requirement as it may delay entries in fast-moving markets
Visual Elements
Green/Red Cloud: Shows bullish/bearish cloud conditions
Yellow Line: Conversion Line (Tenkan-sen)
Blue Line: Base Line (Kijun-sen)
Orange Line: 171-period EMA trend filter
Gray Line: Lagging Span (Chikou Span)
Important Considerations
Limitations
Lagging Nature: Like all Ichimoku strategies, signals may lag significant price moves
Whipsaw Risk: Extended periods of consolidation may generate false signals
Parameter Sensitivity: Custom parameters may not work equally well across all market conditions
Backtesting Notes
Results are based on historical data and past performance does not guarantee future results
The strategy includes realistic slippage and commission costs
Default settings are optimized for backtesting and may need adjustment for live trading
Risk Disclaimer
This strategy is for educational purposes only and should not be considered financial advice. Always conduct your own analysis and risk management before implementing any trading strategy. The unique parameter combinations used may not be suitable for all market conditions or trading styles.
Customization Options
Trade Mode: Switch between "Ichi" and "Cloud" signal generation
Short Trading: Option to enable short positions (disabled by default)
Date Range: Customize backtesting period
All Ichimoku Parameters: Fully customizable for different market conditions
This enhanced Ichimoku implementation provides a structured approach to trend following while maintaining the flexibility to adapt to different trading styles and market conditions.
Range Bar Gaps DetectorRange Bar Gaps Detector
Overview
The Range Bar Gaps Detector identifies price gaps across multiple range bar sizes (12, 24, 60, and 120) on any trading instrument, helping traders spot potential support/resistance zones or breakout opportunities. Designed for Pine Script v6, this indicator detects gaps on range bars and exports data for use in companion scripts like Range Bar Gaps Overlap, making it ideal for multi-timeframe gap analysis.
Key Features
Multi-Range Gap Detection: Identifies gaps on 12, 24, 60, and 120-range bars, capturing both bullish (gap up) and bearish (gap down) price movements.
Customizable Sensitivity: Includes a user-defined minimum deviation (default: 10% of 14-period SMA) for 12-range gaps to filter out noise.
7-Day Lookback: Automatically prunes gaps older than 7 days to focus on recent, relevant price levels.
Data Export: Serializes up to 10 gaps per range (tops, bottoms, start bars, highest/lowest prices, and age) for seamless integration with overlap analysis scripts.
Debugging Support: Plots gap counts and aggregation data in the Data Window for easy verification of detected gaps.
How It Works
The indicator aggregates price movements to simulate higher range bars (24, 60, 120) from a base range bar chart. It detects gaps when the price jumps significantly between bars, ensuring gaps meet the minimum deviation threshold for 12-range bars. Gaps are stored in arrays, serialized for external use, and pruned after 7 days to maintain efficiency.
Usage
Add to your range bar chart (e.g., 12-range) to detect gaps across multiple ranges.
Use alongside the Range Bar Gaps Overlap indicator to visualize gaps and their overlaps as boxes on the chart.
Check the Data Window to confirm gap counts and sizes for each range (12, 24, 60, 120).
Adjust the "Minimal Deviation (%) for 12-Range" input to control gap detection sensitivity.
Settings
Minimal Deviation (%) for 12-Range: Set the minimum gap size for 12-range bars (default: 10% of 14-period SMA).
Range Sizes: Fixed at 24, 60, and 120 for higher range bar aggregation.
Notes
Ensure the script is published under your TradingView username (e.g., GreenArrow2005) for use with companion scripts.
Best used on range bar charts to maintain consistent gap detection.
For advanced overlap analysis, pair with the Range Bar Gaps Overlap indicator to highlight zones where gaps from different ranges align.
Ideal For
Traders seeking to identify key price levels for support/resistance or breakout strategies.
Multi-timeframe analysts combining gap data across various range bar sizes.
Developers building custom indicators that leverage gap data for advanced charting.
minchang volume tradingCondition
Point color
Volume ≥ 3× MA(24)
Violet
Volume ≥ 1.5× MA(24)
Red
Volume < 1.5× MA(24) & bullish
White
Volume < 1.5× MA(24) & bearish
Black
RSI For LoopTitle: RSI For Loop
SurgeQuant’s RSI with Threshold Colors and Bar Coloring indicator is a sophisticated tool designed to identify overbought and oversold conditions using a customizable Relative Strength Index (RSI). By averaging RSI over a user-defined lookback period, this indicator provides clear visual signals for bullish and bearish market conditions. The RSI line and price bars are dynamically colored to highlight momentum, making it easier for traders to spot potential trading opportunities.
How It Works
RSI Calculation:
Computes RSI based on a user-selected price source (Close, High, Low, or Open) with a configurable length (default: 5). Optional moving average smoothing refines the RSI signal for smoother analysis.
Lookback Averaging:
Averages the RSI over a user-defined lookback period (default: 5) to generate a stable momentum indicator, reducing noise and enhancing signal reliability.
Threshold-Based Signals:
Long Signal: Triggered when the averaged RSI exceeds the upper threshold (default: 52), indicating overbought conditions.
Short Signal: Triggered when the averaged RSI falls below the lower threshold (default: 48), indicating oversold conditions.
Visual Representation
The indicator provides a clear and customizable visual interface: Green RSI Line and Bars: Indicate overbought conditions when the averaged RSI surpasses the upper threshold, signaling potential long opportunities.
Red RSI Line and Bars: Indicate oversold conditions when the averaged RSI drops below the lower threshold, signaling potential short opportunities.
Neutral Gray RSI Line: Represents RSI values between thresholds for neutral market conditions.
Threshold Lines: Dashed gray lines mark the upper and lower thresholds on the RSI panel for easy reference.
Customization & Parameters
The RSI with Threshold Colors and Bar Coloring indicator offers flexible parameters to suit
various trading styles: Source: Select the input price (default: Close; options: Close, High, Low, Open).
RSI Length: Adjust the RSI calculation period (default: 5).
Smoothing: Enable/disable moving average smoothing (default: enabled) and set the smoothing length (default: 10).
Moving Average Type: Choose from multiple types (SMA, EMA, DEMA, TEMA, WMA, VWMA, SMMA, HMA, LSMA, ALMA; default: ALMA).
ALMA Sigma: Configure the ALMA smoothing parameter (default: 5).
Lookback Period: Set the period for averaging RSI (default: 5).
Thresholds: Customize the upper (default: 52) and lower (default: 48) thresholds for signal generation.
Color Settings: Transparent green and red colors (70% transparency) for bullish and bearish signals, with gray for neutral states.
Trading Applications
This indicator is versatile and can be applied across various markets and strategies: Momentum Trading: Highlights strong overbought or oversold conditions for potential entry or exit points.
Trend Confirmation: Use bar coloring to confirm RSI-based signals with price action on the main chart.
Reversal Detection: Identify potential reversals when RSI crosses the customizable thresholds.
Scalping and Swing Trading: Adjust parameters (e.g., RSI length, lookback) to suit short-term or longer-term strategies.
Final Note
SurgeQuant’s RSI with Threshold Colors and Bar Coloring indicator is a powerful tool for traders seeking to leverage RSI for momentum and reversal opportunities. Its combination of lookback-averaged RSI, dynamic threshold signals, and synchronized RSI and bar coloring offers a robust framework for informed trading decisions. As with all indicators, backtest thoroughly and integrate into a comprehensive trading strategy for optimal results.
FULLY FUNCTIONAL INDICATOR TESTER🎯 Purpose:
A comprehensive strategy testing framework designed to evaluate custom indicators and trading signals with professional-grade risk management and signal detection capabilities.
✨ Key Features:
Multiple Signal Detection Methods - Value changes, crossovers, threshold-based triggers
Advanced Confluence Filtering - Multi-source confirmation system with lookback periods
Professional Risk Management - Static TP/SL, break-even functionality, position sizing
Custom Exit Signals - Independent exit logic for refined strategy testing
Visual Feedback System - Clear signal plots and real-time status monitoring
Flexible Input Sources - Connect any custom indicator or built-in study
🔧 How to Use:
Connect your indicator outputs to the Entry/Exit source inputs
Select appropriate signal detection method for your indicator type
Configure risk parameters (TP/SL/Break-even)
Enable confluence filters if needed for additional confirmation
Backtest and analyze results with built-in performance metrics
📈 Signal Detection Options:
Value Change: Detects when indicator values change
Crossover Above/Below: Traditional crossover signals
Threshold Triggers: Value-based entry/exit levels
⚙️ Technical Specifications:
Compatible with Pine Script v6
Overlay strategy with position tracking
Real-time performance monitoring table
Configurable margin requirements
Full backtesting compatibility
⚠️ Important Notes:
This is a testing framework - not financial advice
Always validate signals in demo environment first
Past performance does not guarantee future results
Use proper risk management in live trading
🔄 Updates:
Enhanced signal detection algorithms
Improved confluence logic
Added break-even functionality
Visual debugging tools
Perfect for traders and developers looking to systematically tes
Momentum SNR VIP [3 TP + Max 50 Pip SL]//@version=6
indicator("Momentum SNR VIP ", overlay=true)
// === Settings ===
pip = input.float(0.0001, "Pip Size", step=0.0001)
sl_pip = 50 * pip
tp1_pip = 40 * pip
tp2_pip = 70 * pip
tp3_pip = 100 * pip
lookback = input.int(20, "Lookback for S/R", minval=5)
// === SNR ===
pivotHigh = ta.pivothigh(high, lookback, lookback)
pivotLow = ta.pivotlow(low, lookback, lookback)
supportZone = not na(pivotLow)
resistanceZone = not na(pivotHigh)
plotshape(supportZone, title="Support", location=location.belowbar, color=color.blue, style=shape.triangleup, size=size.tiny)
plotshape(resistanceZone, title="Resistance", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny)
// === Price Action ===
bullishEngulfing = close < open and close > open and close > open and open <= close
bearishEngulfing = close > open and close < open and close < open and open >= close
bullishPinBar = close < open and (low - math.min(open, close)) > 1.5 * math.abs(close - open)
bearishPinBar = close > open and (high - math.max(open, close)) > 1.5 * math.abs(close - open)
buySignal = supportZone and (bullishEngulfing or bullishPinBar)
sellSignal = resistanceZone and (bearishEngulfing or bearishPinBar)
// === SL & TP ===
rawBuySL = low - 10 * pip
buySL = math.max(close - sl_pip, rawBuySL)
buyTP1 = close + tp1_pip
buyTP2 = close + tp2_pip
buyTP3 = close + tp3_pip
rawSellSL = high + 10 * pip
sellSL = math.min(close + sl_pip, rawSellSL)
sellTP1 = close - tp1_pip
sellTP2 = close - tp2_pip
sellTP3 = close - tp3_pip
// === Plot Lines ===
plot(buySignal ? buySL : na, title="Buy SL", color=color.red, style=plot.style_line, linewidth=1)
plot(buySignal ? buyTP1 : na, title="Buy TP1", color=color.green, style=plot.style_line, linewidth=1)
plot(buySignal ? buyTP2 : na, title="Buy TP2", color=color.green, style=plot.style_line, linewidth=1)
plot(buySignal ? buyTP3 : na, title="Buy TP3", color=color.green, style=plot.style_line, linewidth=1)
plot(sellSignal ? sellSL : na, title="Sell SL", color=color.red, style=plot.style_line, linewidth=1)
plot(sellSignal ? sellTP1 : na, title="Sell TP1", color=color.green, style=plot.style_line, linewidth=1)
plot(sellSignal ? sellTP2 : na, title="Sell TP2", color=color.green, style=plot.style_line, linewidth=1)
plot(sellSignal ? sellTP3 : na, title="Sell TP3", color=color.green, style=plot.style_line, linewidth=1)
// === Floating Labels on Right Side ===
if buySignal
label.new(x=bar_index + 50, y=buySL, text="SL", style=label.style_label_right, color=color.red, textcolor=color.white)
label.new(x=bar_index + 50, y=buyTP1, text="TP1", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=buyTP2, text="TP2", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=buyTP3, text="TP3", style=label.style_label_right, color=color.green, textcolor=color.white)
if sellSignal
label.new(x=bar_index + 50, y=sellSL, text="SL", style=label.style_label_right, color=color.red, textcolor=color.white)
label.new(x=bar_index + 50, y=sellTP1, text="TP1", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=sellTP2, text="TP2", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=sellTP3, text="TP3", style=label.style_label_right, color=color.green, textcolor=color.white)
// === Signal Markers ===
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === Alerts ===
alertcondition(buySignal, title="Buy Alert", message="🟢 BUY at Support Zone + Price Action")
alertcondition(sellSignal, title="Sell Alert", message="🟡 SELL at Resistance Zone + Price Action")
Fast Fourier Transform [ScorsoneEnterprises]The SCE Fast Fourier Transform (FFT) is a tool designed to analyze periodicities and cyclical structures embedded in price. This is a Fourier analysis to transform price data from the time domain into the frequency domain, showing the rhythmic behaviors that are otherwise invisible on standard charts.
Instead of merely observing raw prices, this implementation applies the FFT on the logarithmic returns of the asset:
Log Return(𝑚) = log(close / close )
This ensures stationarity and stabilizes variance, making the analysis statistically robust and less influenced by trends or large price swings.
For a user-defined lookback window 𝑁:
Each frequency component 𝑘 is computed by summing real and imaginary projections of log-returns multiplied by complex exponential functions:
𝑒^−𝑖𝜃 = cos(𝜃)−𝑖sin(𝜃)
where:
θ = 2πkm / N
he result is the magnitude spectrum, calculated as:
Magnitude(𝑘) = sqrt(Real_Sum(𝑘)^2 + Imag_Sum(𝑘)^2)
This spectrum represents the strength of oscillations at each frequency over the lookback period, helping traders identify dominant cycles.
Visual Analysis & Interpretation
To give traders context for the FFT spectrum’s values, this script calculates:
25th Percentile (Purple Line)
Represents relatively low cyclical intensity.
Values below this threshold may signal quiet, noisy, or trendless periods.
75th Percentile (Red Line)
Represents heightened cyclical dominance.
Values above this threshold may indicate significant periodic activity and potential trend formation or rhythm in price action.
The FFT magnitude of the lowest frequency component (index 0) is plotted directly on the chart in teal. Observing how this signal fluctuates relative to its percentile bands provides a dynamic measure of cyclical market activity.
Chart examples
In this NYSE:CL chart, we see the regime of the price accurately described in the spectral analysis. We see the price above the 75th percentile continue to trend higher until it breaks back below.
In long trending markets like NYSE:PL has been, it can give a very good explanation of the strength. There was confidence to not switch regimes as we never crossed below the 75th percentile early in the move.
The script is also usable on the lower timeframes. There is no difference in the usability from the different timeframes.
Script Parameters
Lookback Value (N)
Default: 30
Defines how many bars of data to analyze. Larger N captures longer-term cycles but may smooth out shorter-term oscillations.
Repeating Trend HighlighterThis custom indicator helps you see when the current price trend is similar to a past trend over the same number of candles. Think of it like checking whether the market is repeating itself.
You choose three settings:
• Lookback Period: This is how many candles you want to measure. For example, if you set it to 10, it looks at the price change over the last 10 bars.
• Offset Bars Ago: This tells the indicator how far back in time to look for a similar move. If you set it to 50, it compares the current move to what happened 50 bars earlier.
• Tolerance (%): This is how closely the moves must match to be considered similar. A smaller number means you only get a signal if the moves are almost the same, while a larger number allows more flexibility.
When the current price move is close enough to the past move you picked, the background of your chart turns light green. This makes it easy to spot repeating trends without studying numbers manually.
You’ll also see two lines under your chart if you enable them: a blue line showing the percentage change of the current move and an orange line showing the change in the past move. These help you compare visually.
This tool is useful in several ways. You can use it to confirm your trading setups, for example if you suspect that a strong rally or pullback is happening again. You can also use it to filter trades by combining it with other indicators, so you only enter when trends repeat. Many traders use it as a learning tool, experimenting with different lookback periods and offsets to understand how often similar moves happen.
If you are a scalper working on short timeframes, you can set the lookback to a small number like 3–5 bars. Swing traders who prefer daily or weekly charts might use longer lookbacks like 20–30 bars.
Keep in mind that this indicator doesn’t guarantee price will move the same way again—it only shows similarity in how price changed over time. It works best when you use it together with other signals or market context.
In short, it’s like having a simple spotlight that tells you: “This move looks a lot like what happened before.” You can then decide if you want to act on that information.
If you’d like, I can help you tweak the settings or combine it with alerts so it notifies you when these patterns appear.
Heiken Ashi Candles - CustomizableHeiken Ashi Candles – Customizable Overlay
This TradingView indicator displays accurate Heiken Ashi candles directly on your price chart, perfectly synced with TradingView’s built-in Heiken Ashi source. It’s ideal for traders who want to backtest or analyze Heiken Ashi structure without switching chart types. The indicator also includes full customization of candle body and wick colors for both bullish and bearish candles—perfect for tailoring your chart visuals to your preferences.
MA5 — 四點高低 + H1/L1 水平線 + 突破/回買 + 月季線交叉//@version=5
indicator("MA5 — 四點高低 + H1/L1 水平線 + 突破/回買 + 月季線交叉", overlay=true)
// 1. 均線設定
ma5 = ta.sma(close, 5)
ma10 = ta.sma(close, 10)
ma20 = ta.sma(close, 20)
ma60 = ta.sma(close, 60) // ← 加上這一行
// 畫出均線
plot(ma5, title="MA5", color=color.red)
plot(ma10, title="MA10", color=color.orange)
plot(ma20, title="MA20", color=color.yellow)
plot(ma60, title="MA60", color=color.green)
// 2. 全域變數:方向、區段極值
var int direction = na
var float segHigh = na
var int segHighBar = na
var float segLow = na
var int segLowBar = na
// 3. 全域變數:儲存兩組高低
var float high1 = na
var int high1Bar = na
var float high2 = na
var int high2Bar = na
var float low1 = na
var int low1Bar = na
var float low2 = na
var int low2Bar = na
// 4. 全域變數:標籤與線段句柄
var label highLbl1 = na
var label highLbl2 = na
var label lowLbl1 = na
var label lowLbl2 = na
var line highLine = na
var line lowLine = na
var line h1Line = na
var line l1Line = na
// 5. 全域變數:回買訊號控制
var bool buyBackShown = false
// 6. 判斷當前段方向
currDir = close > ma5 ? 1 : close < ma5 ? -1 : direction
// 7. 首次初始化
if na(direction)
direction := currDir
segHigh := high
segHighBar := bar_index
segLow := low
segLowBar := bar_index
// 8. 同段內更新極值
if currDir == 1 and high > segHigh
segHigh := high
segHighBar := bar_index
if currDir == -1 and low < segLow
segLow := low
segLowBar := bar_index
// 9. 段落切換:推舊值→更新 H1/L1→刪舊標籤/線→畫新標籤/線→重置 seg*
if currDir != direction
high2 := high1
high2Bar := high1Bar
low2 := low1
low2Bar := low1Bar
if direction == 1
high1 := segHigh
high1Bar := segHighBar
else
low1 := segLow
low1Bar := segLowBar
buyBackShown := false
if not na(highLbl1)
label.delete(highLbl1)
if not na(highLbl2)
label.delete(highLbl2)
if not na(lowLbl1)
label.delete(lowLbl1)
if not na(lowLbl2)
label.delete(lowLbl2)
if not na(high2)
highLbl2 := label.new(high2Bar, high2, "H2", style=label.style_label_down, color=color.blue, textcolor=color.white)
if not na(high1)
highLbl1 := label.new(high1Bar, high1, "H1", style=label.style_label_down, color=color.blue, textcolor=color.white)
if not na(low2)
lowLbl2 := label.new(low2Bar, low2, "L2", style=label.style_label_up, color=color.purple, textcolor=color.white)
if not na(low1)
lowLbl1 := label.new(low1Bar, low1, "L1", style=label.style_label_up, color=color.purple, textcolor=color.white)
if not na(highLine)
line.delete(highLine)
if not na(high1) and not na(high2)
highLine := line.new(high2Bar, high2, high1Bar, high1, color=color.blue, width=2)
if not na(lowLine)
line.delete(lowLine)
if not na(low1) and not na(low2)
lowLine := line.new(low2Bar, low2, low1Bar, low1, color=color.purple, width=2)
if not na(h1Line)
line.delete(h1Line)
if not na(high1)
h1Line := line.new(high1Bar, high1, bar_index, high1, xloc=xloc.bar_index, extend=extend.right, color=color.green, style=line.style_dashed)
if not na(l1Line)
line.delete(l1Line)
if not na(low1)
l1Line := line.new(low1Bar, low1, bar_index, low1, xloc=xloc.bar_index, extend=extend.right, color=color.red, style=line.style_dashed)
segHigh := high
segHighBar := bar_index
segLow := low
segLowBar := bar_index
// 10. 更新方向
direction := currDir
// 11. 突破訊號:收盤首次突破 H1 且 ma5>ma10>ma20
buySignal = not na(high1) and ta.crossover(close, high1) and ma5 > ma10 and ma10 > ma20
if buySignal
label.new(bar_index, low, "突破", style=label.style_label_up, color=color.green, textcolor=color.white)
// 12. 回買訊號:L1 之後任一 K 棒,首次收盤突破 MA5,且高於 L1、漲幅>2%、ma5>ma10>ma20、且收盤>ma20
buyBackSignal = not na(low1) and bar_index > low1Bar and ta.crossover(close, ma5) and high > low1 and (close - open) / open > 0.02 and ma5 > ma10 and ma10 > ma20 and close > ma20 and not buyBackShown
if buyBackSignal
label.new(bar_index, low, "回買", style=label.style_label_up, color=color.green, textcolor=color.white)
buyBackShown := true
// 13. 月季線交叉且四線多頭排列時,在 K 棒正下方標示放大三角形
if ta.cross(ma20, ma60) and ma5 > ma10 and ma10 > ma20 and ma20 > ma60
label.new(bar_index, low, "▲", xloc=xloc.bar_index, yloc=yloc.belowbar, style=label.style_label_center, color=color.new(color.white, 100), textcolor=color.white, size=size.large)
Momentum SNR VIP (Step 2)//@version=6
indicator("Momentum SNR VIP (Step 2)", overlay=true)
// === Inputs ===
lookback = input.int(20, "Lookback for S/R", minval=5)
rr_ratio = input.float(2.0, "Risk-Reward Ratio", minval=0.5, step=0.1)
plot(close, color=color.orange)
Zonas de Soporte EURUSD Multi-Timeframe//@version=5
indicator("Zonas de Soporte EURUSD Multi-Timeframe", overlay=true)
// Configuraciones
lookback = input.int(200, "Velas a analizar", minval=50)
tolerance = input.float(0.5, "Tolerancia %", minval=0.1)
touchesMin = input.int(3, "Toques mínimos para validar soporte", minval=2)
// Función para encontrar zonas de soporte
f_findSupportZones(_low, _label) =>
var float zones = na
var int found = 0
for i = 0 to lookback - 1
float base = _low
int touches = 0
for j = i + 1 to lookback - 1
if math.abs(_low - base) <= base * (tolerance / 100)
touches := touches + 1
if touches >= touchesMin
label.new(bar_index , base, text="Zona " + _label + " " + str.tostring(base, format.mintick),
style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
found := found + 1
found
// Múltiples temporalidades
low_h1 = request.security("EURUSD", "60", low)
low_h4 = request.security("EURUSD", "240", low)
low_d1 = request.security("EURUSD", "D", low)
low_w1 = request.security("EURUSD", "W", low)
low_mn1 = request.security("EURUSD", "M", low)
// Llamadas a la función
zonesH1 = f_findSupportZones(low_h1, "H1")
zonesH4 = f_findSupportZones(low_h4, "H4")
zonesD1 = f_findSupportZones(low_d1, "D1")
zonesW1 = f_findSupportZones(low_w1, "W1")
zonesMN1 = f_findSupportZones(low_mn1, "MN1")
// Reporte
if bar_index % 50 == 0
label.new(bar_index, high, text="Reporte Zonas Soporte H1: "+str.tostring(zonesH1)+" H4: "+str.tostring(zonesH4)+" D1: "+str.tostring(zonesD1)+" W1: "+str.tostring(zonesW1)+" MN1: "+str.tostring(zonesMN1),
style=label.style_label_down, yloc=yloc.abovebar, size=size.normal,
textcolor=color.black, color=color.new(color.white, 80))
Normalized Reserve Risk (Proxy Z-Score)normalised version of the reserve risk indicator on btc magazine because the btc magazine one is poo .
Nến Tô Màu Theo Volume / MA(21)Condition
Point color
Volume ≥ 3× MA(24)
Violet
Volume ≥ 1.5× MA(24)
Red
Volume < 1.5× MA(24) & bullish
White
Volume < 1.5× MA(24) & bearish
Black
My script//@version=5
indicator("MA + OI + Volume Breakout", overlay=true)
// === MA Parameters ===
ma_type = input.string("EMA", title="MA Type", options= )
ma(src, len, type) =>
type == "SMA" ? ta.sma(src, len) :
type == "EMA" ? ta.ema(src, len) :
ta.wma(src, len)
ma5 = ma(close, 5, ma_type)
ma21 = ma(close, 21, ma_type)
ma50 = ma(close, 50, ma_type)
ma100 = ma(close, 100, ma_type)
plot(ma5, "5-day MA", color=color.yellow, linewidth=2)
plot(ma21, "21-day MA", color=color.orange, linewidth=2)
plot(ma50, "50-day MA", color=color.fuchsia, linewidth=2)
plot(ma100, "100-day MA", color=color.blue, linewidth=2)
// === Trend Signal ===
bullish_trend = ma5 > ma21 and ma21 > ma50 and ma50 > ma100
bearish_trend = ma5 < ma21 and ma21 < ma50 and ma50 < ma100
bgcolor(bullish_trend ? color.new(color.green, 85) : bearish_trend ? color.new(color.red, 85) : na)
// === Volume Breakout ===
vol_avg = ta.sma(volume, 20)
vol_breakout = volume > 1.5 * vol_avg
plotshape(vol_breakout, title="Volume Breakout", location=location.belowbar, style=shape.circle, color=color.aqua, size=size.tiny)
// === Open Interest Overlay (assumes OI data via external input or future integration) ===
// Placeholder: simulate OI input (replace with `request.security(syminfo.tickerid, ..., ...)` if available)
oi = input.float(na, title="Open Interest (external feed)")
oi_avg = ta.sma(oi, 20)
oi_breakout = oi > 1.2 * oi_avg
plotshape(not na(oi) and oi_breakout, title="OI Spike", location=location.belowbar, style=shape.diamond, color=color.purple, size=size.tiny)
plot(oi, title="Open Interest", color=color.gray, display=display.none) // Optional: hidden line for alerts
// === Composite Signal ===
strong_long = bullish_trend and vol_breakout and oi_breakout
plotshape(strong_long, title="Strong Long Signal", location=location.belowbar, style=shape.labelup, text="LONG", size=size.small, color=color.lime)
// === Screener Logic ===
// Use `strong_long` as your filter condition in a screener or dashboard output
Momentum SNR VIP [INDICATOR ONLY]//@version=6
indicator("Momentum SNR VIP ", overlay=true)
// === Inputs ===
lookback = input.int(20, "Lookback for S/R", minval=5)
rr_ratio = input.float(2.0, "Risk-Reward Ratio", minval=0.5, step=0.1)
// === SNR Detection ===
pivotHigh = ta.pivothigh(high, lookback, lookback)
pivotLow = ta.pivotlow(low, lookback, lookback)
supportZone = not na(pivotLow)
resistanceZone = not na(pivotHigh)
plotshape(supportZone, title="Support", location=location.belowbar, color=color.blue, style=shape.triangleup, size=size.tiny)
plotshape(resistanceZone, title="Resistance", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny)
// === Price Action ===
bullishEngulfing = close < open and close > open and close > open and open <= close
bearishEngulfing = close > open and close < open and close < open and open >= close
bullishPinBar = close < open and (low - math.min(open, close)) > 1.5 * math.abs(close - open)
bearishPinBar = close > open and (high - math.max(open, close)) > 1.5 * math.abs(close - open)
buySignal = supportZone and (bullishEngulfing or bullishPinBar)
sellSignal = resistanceZone and (bearishEngulfing or bearishPinBar)
// === SL & TP ===
buySL = low - 10
buyTP = close + (close - buySL) * rr_ratio
sellSL = high + 10
sellTP = close - (sellSL - close) * rr_ratio
// === Plot Signals
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
plot(buySignal ? buySL : na, title="Buy SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(buySignal ? buyTP : na, title="Buy TP", color=color.green, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellSL : na, title="Sell SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellTP : na, title="Sell TP", color=color.green, style=plot.style_linebr, linewidth=1)
// === Labels (Fixed)
if buySignal
label.new(x=bar_index, y=buySL, text="SL : " + str.tostring(buySL, "#.00"), style=label.style_label_down, color=color.red, textcolor=color.white)
label.new(x=bar_index, y=buyTP, text="TP 1 : " + str.tostring(buyTP, "#.00"), style=label.style_label_up, color=color.green, textcolor=color.white)
if sellSignal
label.new(x=bar_index, y=sellSL, text="SL : " + str.tostring(sellSL, "#.00"), style=label.style_label_up, color=color.red, textcolor=color.white)
label.new(x=bar_index, y=sellTP, text="TP 1 : " + str.tostring(sellTP, "#.00"), style=label.style_label_down, color=color.green, textcolor=color.white)
// === Alerts
alertcondition(buySignal, title="Buy Alert", message="🟢 BUY at Support Zone + Price Action")
alertcondition(sellSignal, title="Sell Alert", message="🟡 SELL at Resistance Zone + Price Action")