Inside Bar (Body-based) Ind/AlertDescription:
This indicator detects Inside Bar patterns based strictly on the candle body (open/close range) of the mother candle, rather than the traditional high/low wick method. An inside bar is highlighted when the current candle’s entire body is contained within the body of the previous candle.
It can be useful for traders who want a more conservative and reliable definition of inside bars, focusing on true consolidation periods and filtering out signals caused by extended wicks.
Features:
Body-based Inside Bar detection:
The indicator colors and marks candles where the current bar’s body is fully within the previous bar’s body.
Bullish/Bearish identification:
Bullish inside bars are marked in green, bearish in red.
Double Inside Bar Detection:
An optional feature marks when two consecutive candles’ bodies are inside the same mother bar body—potentially indicating stronger consolidation.
Alerts:
Set alerts for single or double inside bars for automated monitoring.
How to Use:
Add the indicator to your chart.
Look for colored bars or plotted shapes for inside bar signals based on candle bodies.
Use alerts to get notified in real time when inside bar patterns appear.
Note:
This script uses only the candle body (open and close) for inside bar calculations, which may help filter out less reliable signals found with wick-based approaches.
Candlestick analysis
Enigma Sniper 369The "Enigma Sniper 369" is a custom-built Pine Script indicator designed for TradingView, tailored specifically for forex traders seeking high-probability entries during high-volatility market sessions.
Unlike generic trend-following or scalping tools, this indicator uniquely combines session-based "kill zones" (London and US sessions), momentum-based candle analysis, and an optional EMA trend filter to pinpoint liquidity grabs and reversal opportunities.
Its originality lies in its focus on liquidity hunting—identifying levels where stop losses are likely clustered (around swing highs/lows and wick midpoints)—and providing visual entry zones that are dynamically removed once price breaches them, reducing clutter and focusing on actionable signals.
The name "369" reflects the structured approach of three key components (session timing, candle logic, and trend filter) working in harmony to snipe precise entries.
What It Does
"Enigma Sniper 369" identifies potential buy and sell opportunities by drawing two types of horizontal lines on the chart during user-defined London and US
session kill zones:
Solid Lines: Mark the swing low (for buys) or swing high (for sells) of a trigger candle, indicating a potential entry point where stop losses might be clustered.
Dotted Lines: Mark the 50% level of the candle’s wick (lower wick for buys, upper wick for sells), serving as a secondary confirmation zone for entries or tighter stop-loss placement.
These lines are plotted only when specific candle conditions are met within the kill zones, and they are automatically deleted once the price crosses them, signaling that the liquidity at that level has likely been grabbed. The indicator also includes an optional EMA filter to ensure trades align with the broader trend, reducing false signals in choppy markets.
How It Works
The indicator’s logic is built on a multi-layered approach:
Kill Zone Timing: Trades are only considered during user-defined London and US session hours (e.g., London from 02:00 to 12:00 UTC, as seen in the screenshots). These sessions are known for high volatility and liquidity, making them ideal for capturing institutional moves.
Candle-Based Momentum Logic:
Buy Signal: A candle must close above its midpoint (indicating bullish momentum) and have a lower low than the previous candle (suggesting a potential liquidity grab below the previous swing low). This is expressed as close > (high + low) / 2 and low < low .
Sell Signal: A candle must close below its midpoint (bearish momentum) and have a higher high than the previous candle (indicating a potential liquidity grab above the previous swing high), expressed as close < (high + low) / 2 and high > high .
These conditions ensure the indicator targets candles that break recent structure to hunt stop losses while showing directional momentum.
Optional EMA Filter: A 50-period EMA (customizable) can be enabled to filter signals based on trend direction.
Buy signals are only generated if the EMA is trending upward (ema_value > ema_value ), and sell signals require a downward EMA trend (ema_value < ema_value ). This reduces noise by aligning entries with the broader market trend.
Liquidity Levels and Deletion Logic:
For a buy signal, a solid green line is drawn at the candle’s low, and a dotted green line at the 50% level of the lower wick (from the candle body’s bottom to the low).
For a sell signal, a solid red line is drawn at the candle’s high, and a dotted red line at the 50% level of the upper wick (from the body’s top to the high).
These lines extend to the right until the price crosses them, at which point they are deleted, indicating the liquidity at that level has been taken (e.g., stop losses triggered).
Alerts: The indicator includes alert conditions for buy and sell signals, notifying traders when a new setup is identified.
Underlying Concepts
The indicator is grounded in the concept of liquidity hunting, a strategy often employed by institutional traders. Markets frequently move to levels where stop losses are clustered—typically just beyond swing highs or lows—before reversing in the opposite direction. The "Enigma Sniper 369" targets these moves by identifying candles that break structure (e.g., a lower low or higher high) during high-volatility sessions, suggesting a potential sweep of stop losses. The 50% wick level acts as a secondary confirmation, as this midpoint often represents a zone where tighter stop losses are placed by retail traders. The optional EMA filter adds a trend-following element, ensuring entries are taken in the direction of the broader market momentum, which is particularly useful on lower timeframes like the 15-minute chart shown in the screenshots.
How to Use It
Here’s a step-by-step guide based on the provided usage example on the GBP/USD 15-minute chart:
Setup the Indicator: Add "Enigma Sniper 369" to your TradingView chart. Adjust the London and US session hours to match your timezone (e.g., London from 02:00 to 12:00 UTC, US from 13:00 to 22:00 UTC). Customize the EMA period (default 50) and line styles/colors if desired.
Identify Kill Zones: The indicator highlights the London session in light green and the US session in light purple, as seen in the screenshots. Focus on these periods for signals, as they are the most volatile and likely to produce liquidity grabs.
Wait for a Signal: Look for solid and dotted lines to appear during the kill zones:
Buy Setup: A solid green line at the swing low and a dotted green line at the 50% lower wick level indicate a potential buy. This suggests the market may have grabbed liquidity below the swing low and is now poised to move higher.
Sell Setup: A solid red line at the swing high and a dotted red line at the 50% upper wick level indicate a potential sell, suggesting liquidity was taken above the swing high.
Place Your Trade:
For a buy, set a buy limit order at the dotted green line (50% wick level), as this is a more conservative entry point. Place your stop loss just below the solid green line (swing low) to cover the full swing. For example, in the screenshots, the market retraces to the dotted line at 1.32980 after a liquidity grab below the swing low, triggering a buy limit order.
For a sell, set a sell limit order at the dotted red line, with a stop loss just above the solid red line.
Monitor Price Action: Once the price crosses a line, it is deleted, indicating the liquidity at that level has been taken. In the screenshots, after the buy limit is triggered, the market moves higher, confirming the setup. The caption notes, “The market returns and tags us in long with a buy limit,” highlighting this retracement strategy.
Additional Context: Use the indicator to identify liquidity levels that may be targeted later. For example, the screenshot notes, “If a new session is about to open I will wait for the grab liquidity to go long,” showing how the indicator can be used to anticipate future moves at session opens (e.g., London open at 1.32980).
Risk Management: Always set a stop loss below the swing low (for buys) or above the swing high (for sells) to protect against adverse moves. The 50% wick level helps tighten entries, improving the risk-reward ratio.
Practical Example
On the GBP/USD 15-minute chart, during the London session (02:00 UTC), the indicator identifies a buy setup with a solid green line at 1.32901 (swing low) and a dotted green line at 1.32980 (50% wick level). The market initially dips below the swing low, grabbing liquidity, then retraces to the dotted line, triggering a buy limit order. The price subsequently rises to 1.33404, yielding a profitable trade. The user notes, “The logic is in the last candle it provides new level to go long,” emphasizing the indicator’s ability to identify fresh levels after a liquidity sweep.
Customization Tips
Adjust the EMA period to suit your timeframe (e.g., a shorter period like 20 for faster signals on lower timeframes).
Modify the session hours to align with your broker’s timezone or specific market conditions.
Use the alert feature to get notified of new setups without constantly monitoring the chart.
Why It’s Useful for Traders
The "Enigma Sniper 369" stands out by combining session timing, momentum-based candle analysis, and liquidity hunting into a single tool. It provides clear, actionable levels for entries and stop losses, removes invalid signals dynamically, and aligns trades with high-probability market conditions. Whether you’re a scalper looking for quick moves during London open or a swing trader targeting session-based reversals, this indicator offers a structured, data-driven approach to trading.
IU Three Line Strike Candlestick PatternIU Three Line Strike Candlestick Pattern
This indicator identifies the Three Line Strike candlestick pattern — a rare yet powerful 4-bar reversal setup that captures exhaustion and momentum shifts at the end of strong trends.
Pattern Logic:
The Three Line Strike is a 4-candle pattern that typically signals a sharp reversal after a sustained directional move. This script detects both bullish and bearish variations using strict criteria to ensure accuracy.
Bullish Three Line Strike:
* Previous three candles must be bearish (red)
* Each of these candles must close progressively lower (indicating a strong downtrend)
* The current candle must:
* Be bullish (green)
* Open below the prior close
* Completely engulf the previous three candles by closing above the first candle's open
* And make a higher high than the last 3 bars — confirming a strong reversal
* Once confirmed, a green shaded box is drawn around the 4-bar zone to highlight the pattern
Bearish Three Line Strike:
* Previous three candles must be bullish (green)
* Each must close progressively higher (indicating a strong uptrend)
* The current candle must:
* Be bearish (red)
* Open above the prior close
* Completely engulf the prior three candles by closing below the first candle's open
* And make a lower low than the last 3 bars — confirming downside strength
* A red shaded box is plotted around the 4-bar formation to emphasize the reversal zone
Why this is unique:
Most candlestick tools focus on 1–2 bar patterns. The Three Line Strike goes a step further by combining trend exhaustion (3 same-colored candles) with a full reversal engulfing candle. This pattern is both rare and highly expressive of sentiment shift, making it a standout signal for discretionary and algorithmic traders alike.
How users can benefit:
* High-probability setups: Filters out weak signals using multi-bar confirmation logic
* Clear visual cues: Dynamic shaded boxes and labels make spotting reversals effortless
* Cross-timeframe compatible: Works on intraday and higher timeframes across all markets
* Real-time alerts: Get notified instantly when a bullish or bearish setup forms
This indicator is a valuable addition for traders who want to capture key reversals backed by strong multi-bar price action logic. Whether you are a price action purist or a pattern-based strategist, the IU Three Line Strike gives you a reliable edge.
Disclaimer:
This script is for educational purposes only and does not constitute financial advice. Trading involves risk, and past performance is not indicative of future results. Always do your own research and consult with a licensed financial advisor before making trading decisions.
VWAP + Engulfing CandlesHere’s a clear breakdown of what your merged Pine Script does:
---
### 📌 **Indicator Name: VWAP + Engulfing Candles**
* This custom TradingView indicator **plots VWAP (Volume Weighted Average Price)** along with **up to 3 dynamic bands** around it.
* It also **detects Bullish and Bearish Engulfing Candlestick Patterns**, displaying visual markers and triggering alerts.
---
## 🔹 **1. VWAP Section**
### ➤ **Main Features:**
* Calculates VWAP anchored to a **customizable time period**:
* Options: Session, Week, Month, Quarter, Year, Decade, Century, Earnings, Dividends, Splits.
* Optional **hiding of VWAP on Daily/Weekly/Monthly charts** to reduce clutter.
### ➤ **Bands Around VWAP:**
* Up to **3 bands** can be plotted above and below the VWAP.
* Bands can be based on either:
* **Standard Deviation** of the price from VWAP (volatility-based), or
* **Percentage** deviation from VWAP (fixed range).
* You can control:
* Whether each band is shown
* Band width via multiplier (e.g., 1x, 2x, 3x)
### ➤ **Plot Colors:**
* VWAP: Blue
* Bands: Green (1x), Olive (2x), Teal (3x)
* Band fill areas are semi-transparent.
---
## 🔹 **2. Engulfing Candlestick Pattern Detector**
### ➤ **Bullish Engulfing Criteria:**
* Current candle opens **below** or **equal to** the close of the previous candle.
* Current candle opens **below** the previous candle's open.
* Current candle closes **above** the previous candle’s open.
### ➤ **Bearish Engulfing Criteria:**
* Current candle opens **above** or **equal to** the close of the previous candle.
* Current candle opens **above** the previous candle’s open.
* Current candle closes **below** the previous candle’s open.
### ➤ **Visual Signals:**
* 🔼 Green triangle **below bar** for **Bullish Engulfing**
* 🔽 Red triangle **above bar** for **Bearish Engulfing**
### ➤ **Alerts:**
* The script includes two alert conditions:
* One for Bullish Engulfing
* One for Bearish Engulfing
These alerts can be used to automate notifications for potential reversal points.
---
## 🛠️ **Use Cases**
* **Trend following or reversal spotting**: VWAP helps identify the average trading price; engulfing patterns often signal reversals.
* **Intraday and swing trading**: Works best on timeframes like 5m, 15m, 1h for intraday, or 4h, 1D for swing.
* **Mean reversion strategies**: Bands help spot overbought/oversold areas relative to VWAP.
📊 Portfolio TrackerPortfolio Tracker
🧠 How This Script Works
This Pine Script generates a dynamic portfolio table in the upper-right corner of your chart. It:
Monitors your positions in: BTC, SOL, ADA, XRP, and XAU (Gold).
Calculates for each asset:
Current value,
Profit/Loss in your currency ,
Percentage change.
Color-coded output:
🟢 Green = Profit
🔴 Red = Loss
Automatically updates every few candles.
Tracks total portfolio value, PnL, and % return.
Triggers custom alerts when:
Total portfolio profit exceeds +5% or +10%.
🛠️ How to Customize It for Your Own Portfolio
🔹 1. Update your personal asset data
Inside the // === INPUTS === section of the code, modify these lines:
btc1_qty = 0.0013
btc1_entry = 72831.80
Repeat for each asset you own:
Replace xxx_qty with your amount.
Replace xxx_entry with your buy price (in your currency).
Make sure the request.security(...) line fetches the correct symbol.
🔹 2. Add more assets (optional)
Duplicate any block like ADA and change the variable names and symbols:
new_qty = ...
new_entry = ...
new_price = request.security("BINANCE:NEWTOKENUSD", timeframe.period, close)
Also include the new asset in:
total_pnl += ...
total_value_now += ...
total_cost += ...
The table.cell(...) block to show it in the table.
Why This Tool Rocks
Tracks all your holdings in one chart panel.
Requires no API or external data feed.
Real-time updates based on TradingView chart prices.
Fully editable and extendable to any other token or asset.
Custom Green Candle Signalbuying candle indicates...................................................................................................
NIFTY Option Chain Table with Custom CE/PE Price FiltersThis Pine Script creates a powerful and visually organized option chain dashboard for NIFTY Index Options, showing 10 Call Options (CE) and 10 Put Options (PE), with real-time prices updated on a 5-minute chart.
You can filter and view only the most relevant option contracts based on your preferred price ranges, helping you make quick decisions for scalping, intraday, or positional trades.
🔍 How It Works:
You manually select up to 10 Call Option symbols and 10 Put Option symbols from NSE (e.g., NIFTY240530C18000, NIFTY240530P18000, etc.).
Keep that time options this are old options in defalt so there will be a error
The script fetches the real-time close price of each option using the request.security() function.
You define the minimum and maximum price range separately for Calls and Puts.
The script filters out any options that fall outside of your desired price range.
Only a limited number of matching options (as set by you) are displayed in the table for both Calls and Puts.
The table is shown at your preferred location on the chart (Bottom Right, Top Left, etc.).
✅ Features:
🔟 Supports exactly 10 CE and 10 PE options for tracking.
📈 Live price updates pulled directly from the chart timeframe (5-min).
🎯 Custom price filters for CE and PE (separate inputs).
📊 Show only the top X number of contracts that meet your filter criteria.
🧱 Vertical layout with clear headers and color-coded sections (green for Calls, red for Puts).
🎛️ Position the table wherever it's most convenient on your chart.
⚡ Helps you quickly spot low premium or range-bound options during the day.
📌 Use Case:
Ideal for:
Option scalpers and day traders who want to focus only on options within a specific price zone.
Traders who want to monitor multiple strikes simultaneously without clutter.
Users building custom NIFTY strategies based on option premiums.
Sunday OpenThis indicator shows the opening price of the daily candle on Sunday .
This price range is a good confirmation for the price reversal. Also, this level is a strong range from which the price gives a good reaction .
This Sunday open line can be used as an additional confirmation to the trading strategy to have a clearer entry point.
Full Rejection Alerts (Bullish & Bearish)- Bearish Engulfing
- Bearish Pin Bar
- Bullish Engulfing
- Bullish Pin Bar
3 MA/EMA Khít Chính XácThis script is designed to detect highly precise convergence of 3 moving averages: MA(8), MA(21), and EMA(21).
When these three lines meet very closely on the chart, it may indicate a potential breakout or trend change.
Useful for short-term momentum traders who want to identify low-risk entry zones.
Includes:
- Real-time alert condition when MA lines converge
- Optional Bollinger Band smoothing
- Triangle-shaped visual signal for convergence points
Created by KimTrading 🟡 | For 1-min to 1H scalping & trend analysis.
DUP V12B (tích hợp nến động lượng)DUP V12B - Dynamic Universal Points (Momentum Candles & 3-Tier Menu)
Authors: Đinh Ngọc Thạch
Version: 12B (DUP V12B)
Date: May 15, 2025 (Conceptual publication date based on script header)
Introduction
Welcome to DUP V12B, an advanced TradingView strategy meticulously crafted by Đinh Ngọc Thạch with AI assistance from Gemini. This version builds upon the robust foundation of DUP V11, introducing significant refinements to its core signal logic for bottoming/topping detection, adaptive thresholds, and a highly intuitive 3-Tier Menu System for unparalleled user customization.
A key innovation in V12B is the integration of Dynamic Momentum Candles, offering a unique visual perspective on price action relative to volatility channels. This, combined with a streamlined approach that removes the previous complex "Tier 2" system, focuses on delivering clearer, more actionable insights.
The DUP (Dynamic Universal Points) philosophy centers around identifying potential market turning points by analyzing market context, applying adaptive thresholds, and confirming signals through a consensus of technical indicators. Whether you're a novice trader or an experienced quantitative researcher, DUP V12B provides a flexible and powerful toolkit to explore market dynamics.
Disclaimer
Trading involves substantial risk of loss and is not suitable for every investor. The DUP V12B strategy is provided for educational and informational purposes only. It does not constitute financial advice or a recommendation to buy or sell any 1 financial instrument. All trading decisions are your sole responsibility. Past performance is not indicative of future results. Backtest thoroughly and use at your own risk.
1.
github.com
github.com
User Guide
Core Concepts
DUP Philosophy: DUP stands for Dynamic Universal Points. The strategy aims to identify potential market bottoms for buying opportunities (and tops for selling, primarily through "Peak Detection") by adapting its parameters and signal thresholds to the prevailing market conditions.
Market Regimes: The script categorizes the market (based on a reference Index like VNINDEX) into three regimes:
REGIME_DOWNTREND: The reference index is in a downtrend.
REGIME_BOTTOMING_RANGE: The reference index is in a consolidation/bottoming phase or not in a clear trend.
REGIME_UPTREND: The reference index is in an uptrend.
LBU (Laddered Buy-in Units): This system allows for scaling into positions. Instead of entering with the full intended capital at once, LBU enables multiple entries (up to 5, configurable) as the price potentially moves into more favorable zones, based on pre-defined or adaptive ratios of your total allocated capital for that specific symbol.
Peak Detection Sell: This is a prioritized selling logic. If enabled, the strategy will actively look for signs of a market top (e.g., RSI falling from overbought, bearish divergences) to exit positions, potentially overriding standard exit methods like Trailing Stops or Take Profits.
Adaptive Layer: The strategy can adjust its internal sensitivity and signal thresholds (e.g., minimum score required for a buy signal) based on the broader market context (trend and volatility). This helps the script to be more or less aggressive depending on market conditions.
Momentum Candles: A new visualization feature in V12B. When enabled, the script plots its own candles, colored based on their position within a chosen volatility channel (Bollinger Bands %B or Keltner Channels). To use this effectively, you MUST HIDE THE ORIGINAL CHART CANDLES via TradingView's main chart settings.
Operating Modes (Key Feature)
DUP V12B introduces a 3-Tier menu system to cater to different user needs. It's crucial to only adjust settings relevant to your selected Operation Mode.
MODE_BASIC (1. Basic - Đơn giản):
The simplest mode, designed for quick setup and ease of use.
Allows toggling main features on/off (e.g., enable simple adaptive mode, show buy/sell signals, choose basic buy signal types, select primary sell methods).
Ideal for beginners or users who prefer a less granular approach.
MODE_ADVANCED (2. Advanced - Nâng cao):
Offers more detailed control over the strategy's parameters.
Fine-tune buy signal components (RSI, Stoch, Volume, Candle, etc.), LBU settings (ratios, max entries), standard exit parameters (Stop Loss, Trailing Stop, Take Profit types and values), Peak Detection Sell logic, and the overall sensitivity of the Adaptive Layer.
Suitable for traders who want to tailor the strategy more closely to specific instruments or their trading style.
MODE_PREMIUM (3. Premium - Developer):
Provides complete control over all aspects of the strategy, including its core "brain."
Market Context Engine: Configure how the script analyzes the reference market index.
Adaptive Layer Deep Dive: Manually input market/volatility scores, blend scores, and fine-tune impact factors.
Scoring Logic (Buy/Sell): Adjust the base thresholds and weights for each individual buy/sell confirmation signal.
V17 Legacy Params (Research): Access to older dynamic parameter settings for research purposes.
Debug Options: Display detailed internal states for in-depth analysis.
This mode is intended for advanced users, quantitative researchers, or those who wish to deeply understand and experiment with the script's internal mechanics.
Key Input Sections Walkthrough
0. CHẾ ĐỘ HOẠT ĐỘNG (QUAN TRỌNG) (Operation Mode - IMPORTANT):
This is the first and most critical setting. Choose Basic, Advanced, or Premium. Your choice here determines which subsequent settings are active and relevant.
1. BASIC MODE SETTINGS: (Only active if MODE_BASIC is selected)
🧠 Bật Chế độ Bám theo Thị trường (Thích ứng Đơn giản)?: Enables/disables a simplified adaptive behavior.
📈 Hiện Tín hiệu Mua? / 📉 Hiện Tín hiệu Bán?: Toggles visibility of buy/sell signal shapes on the chart.
Buy Signal Sources:
Sử dụng Phân kỳ làm Tín hiệu Mua?: Use bullish divergence as a buy condition.
Sử dụng RSI/Stoch Quá bán?: Use oscillator (RSI/Stoch) crossover from oversold as a buy condition.
Sử dụng Nến & Volume?: Use strong bullish candles and volume spikes as buy conditions.
Sell Methods:
🔥 Ưu tiên Bán Dò Đỉnh?: If enabled, prioritizes peak detection signals for exits.
💧 Sử dụng Dừng lỗ Động (Trailing Stop)?: Enables trailing stop (effective if Peak Sell is off or not triggered).
🛡️ Sử dụng Dừng lỗ Cố định (Stop Loss)?: Enables a fixed initial stop loss.
2. ADVANCED MODE SETTINGS: (Active if MODE_ADVANCED or MODE_PREMIUM is selected. Basic mode uses defaults from these.)
2.1. Advanced - Buy Signals & Base Params:
EMA Dài hạn (Base): Length for the long-term Exponential Moving Average.
Loại Kênh Trigger: Choose "Keltner Channel" or "Bollinger Bands" as the primary trigger for buy zones.
KC/BB Parameters: Lengths, Multipliers/Standard Deviations (these are "Base" values, potentially adjusted by the adaptive layer if active in Premium).
Detailed Buy Confirmation Toggles: Enable/disable and configure parameters for RSI (Oversold, Divergence), Volume, Candle patterns, Stochastic (Oversold, Divergence), MACD crossover, OBV trend, and ADX weakness.
2.2. Advanced - LBU Settings:
Tổng Vốn Dự kiến (Cho mã này) & Đơn vị Tiền tệ: Your intended total capital for this specific trading instrument and its currency (used for calculating position size with strategy.cash).
Chế độ Giải ngân LBU:
"Fixed Ratio": Uses pre-defined fixed percentage steps for LBU.
"Adaptive Ratio": (Currently simplified in V12 - may use a fixed factor).
"Custom Ratio": Manually set the percentage of capital for each LBU entry (LBU 1% to LBU 5%).
Số Lần Mua Tối Đa (Bậc LBU): Maximum number of LBU entries (1 to 5).
Tỷ lệ LBU 1 (%) - Tỷ lệ LBU 5 (%): Custom percentages for each LBU step if "Custom Ratio" is selected.
Buffer Giá LBU (%): Allows buying on a new LBU step if the new low is not strictly lower than the previous buy's low, but within this buffer percentage. 0.0 requires a strictly lower low.
⛔ Chặn Mua khi vào Uptrend?: Prevents further LBU entries if the market regime shifts to REGIME_UPTREND.
2.3. Advanced - Standard Exit Settings (SL/TS/TP):
Stop Loss (SL):
🛡️ Bật Stop Loss Chuẩn?: Enable/disable standard stop loss.
Loại SL: "ATR" (based on Average True Range) or "Swing Low" (based on recent lowest lows).
Parameters for ATR (Length, Base Multiplier) and Swing Low (Lookback, Buffer ATR Multiplier).
Trailing Stop (TS):
💧 Bật Trailing Stop Chuẩn?: Enable/disable standard trailing stop.
Loại TS: "EMA Trail", "PSAR", "Chandelier Trail", "ATR Trail (SuperTrend)".
Base parameters for each TS type (e.g., EMA Length, PSAR Start/Inc/Max, Chandelier Period/Multiplier, ATR Trail Length/Multiplier).
Take Profit (TP):
🎯 Loại Chốt lời:
"Không dùng TP": Disables automatic take profit.
"TP Đa mức (ATR/RR/Kênh)": Calculates 1-3 TP levels based on ATR, Risk/Reward, or Channel Uppers.
"TP % Mục tiêu": Exits when a fixed profit percentage from the average entry price is reached.
% Lãi Mục tiêu: The target profit percentage if "TP % Mục tiêu" is chosen.
Settings for "TP Đa mức":
Bật Tính toán & Vẽ TP Đa mức?: Whether to calculate and display these levels (useful even if not auto-exiting).
Số Mức TP Đa mức: How many TP levels to calculate (1-3).
Cách Tính TP Đa mức: "KC/BB Upper", "ATR Offset", "Fixed RR".
Detailed parameters for each calculation method.
Tự động Thoát lệnh tại TP Đa mức?: If "TP Đa mức" is the chosen type, enable this to auto-exit.
Mức TP Đa mức Thoát lệnh: Which of the calculated TP levels (1, 2, or 3) will trigger an automatic exit.
2.4. Advanced - Peak Detection Sell Settings:
🔥 Ưu tiên Bán Dò Đỉnh?: Enables the Peak Sell mode.
Signal Sources: RSI Fall from Overbought (OB), Bearish Divergence (RSI or MACD source), Stochastic OB Cross. Includes parameters like thresholds, lookbacks.
Logic Kết hợp Đỉnh: "ANY" (any peak signal triggers) or "ALL" (all enabled peak signals must trigger).
2.5. Advanced - Adaptive Layer Control:
🧠 Bật Chế độ Thích ứng?: Enable/disable the adaptive adjustments for Advanced mode.
⚙️ Độ nhạy Thích ứng Tổng thể: Controls how strongly the adaptive layer influences thresholds (uses internal market scores in this mode).
3. PREMIUM (DEV) MODE SETTINGS: (Only active if MODE_PREMIUM is selected)
3.1. Premium - Market Context Engine: Configure the reference Index (HOSE:VNINDEX by default), EMA/RSI/ADX/BB lengths, and thresholds for defining market regimes and internal scores.
3.2. Premium - Adaptive Layer Deep Dive: Input manual market/volatility scores, choose the source for adaptive scores ("Manual", "Internal Assessment", "Blended"), adjust overall sensitivity, and fine-tune impact factors for trend, volatility, and breadth. Includes base parameters for trailing stops that can be adaptively modified.
3.3. Premium - Scoring Logic (Buy/Sell): Set base minimum scores for bottoming/topping and, critically, assign weights (w - ...) to each individual confirmation signal (e.g., w - RSI OS, w - Divergence). This determines how influential each signal is in the overall buy/sell consensus score. Option to Điều chỉnh Trọng số Tín hiệu theo Bối cảnh TT? (Adjust signal weights by market context).
3.4. Premium - V17 Legacy Params (Research): For research, enables older V17 dynamic parameter adjustments.
3.5. Premium - Debug Options: Show detailed debug information on the chart for market context, adaptive layer calculations, scoring, and signal states.
4. COMMON SETTINGS - Display & UI:
Toggles for showing/hiding Buy (▲) / Sell (▼) shapes, EMA line, Trigger Channel lines, SL/TS/TP lines.
Buy Label customization (background/text color, size, offset).
Tô màu Nến theo Tín hiệu?: Note: This is traditional bar coloring. For the new Momentum Candles, see section 5 and disable this if using Momentum Candles.
Dashboard settings: Show/hide, position, background/text color, and toggles for what information to display (Market Context, Scores, LBU status, Position, SL/TP distance, Exit Mode).
5. COMMON SETTINGS - Momentum Candle Viz: (New in V12B)
🕯️ Bật Tô màu Nến Động Lượng?: Enable this to use Momentum Candles. If enabled, you MUST HIDE THE ORIGINAL CHART CANDLES from TradingView's main chart style settings for the effect to be visible correctly.
MC - Nguồn Vị Trí Nến: Choose "Bollinger Bands (%B)" or "Keltner Channels" as the basis for candle coloring.
Parameters for the chosen indicator (BB Length/Mult or KC Length/Mult for momentum calculation).
MC - Màu Bắt đầu (Thấp) & MC - Màu Kết thúc (Cao): Gradient colors for the candle body.
MC - Màu Bấc Nến & MC - Độ Trong Suốt Thân (%): Wick color and body transparency.
6. COMMON SETTINGS - Alert Messages:
Templates for Buy, Stop Loss, Trailing Stop, Take Profit, and Peak Sell alerts. You can customize these using placeholders (see "Alerts" section below).
How to Use
Initial Setup: Add the DUP V12B script to your chart. The first and most important step is to select your desired ⚙️ Chọn Chế độ Hoạt động (Operation Mode).
Basic Mode Users:
Navigate to "1. BASIC MODE SETTINGS."
Toggle the main features on/off as per your preference (e.g., Bật Chế độ Bám theo Thị trường, choose buy signal sources, select sell methods).
Advanced Mode Users:
Navigate to "2. ADVANCED MODE SETTINGS."
Configure Buy Signals & Base Parameters (EMA, Trigger Channel, confirmation indicators).
Set up your LBU strategy (Total Capital, Ratios, Max Entries).
Define your Standard Exit rules (SL, TS, TP types and their specific parameters).
Configure Peak Detection Sell if you intend to use it.
Adjust Adaptive Layer sensitivity if desired.
Premium Mode Users:
Navigate to "3. PREMIUM (DEV) MODE SETTINGS."
Dive deep into the Market Context Engine, Adaptive Layer, Scoring Logic, etc. Exercise caution, as these settings significantly impact the strategy's core behavior.
Momentum Candles (All Modes):
If you enable 🕯️ Bật Tô màu Nến Động Lượng? in "5. COMMON SETTINGS - Momentum Candle Viz," remember to hide the main chart's candles. Right-click on the chart -> Settings -> Symbol -> Untick "Body", "Borders", "Wick". This will prevent visual overlap.
LBU (Laddered Buy-in Units):
The strategy will attempt to buy in multiple steps if LBU is configured for more than one entry.
Each buy signal (rawDupBuySignal) is a potential LBU entry. The actual entry depends on lbuCounter, price conditions (lowerPriceCondition), budget, and uptrend restrictions.
Your Tổng Vốn Dự kiến is divided according to the LBU ratios for each entry.
Exits:
The strategy has a clear exit hierarchy:
Stop Loss (Hard SL): Always has the highest priority.
Peak Sell Mode (If Active): If Ưu tiên Bán Dò Đỉnh? is enabled and a peak sell signal occurs, this will take precedence over standard TS/TP.
Standard Exits (If Peak Sell is Inactive or Not Triggered): Trailing Stop or Take Profit (either multi-level or target %).
Dashboard:
Enable the Dashboard in "4. COMMON SETTINGS - Display & UI" to get a real-time overview of the market regime, current buy/sell scores vs. thresholds, LBU status, active position details, and SL/TP distances.
Alerts
The DUP V12B strategy supports customizable alert messages using placeholders that get dynamically replaced with real-time values when an alert is triggered.
Placeholders: You can use placeholders like:
{{ticker}}: Trading symbol (e.g., BTCUSD)
{{exchange}}: Exchange name (e.g., NASDAQ)
{{price}}: Price at which the alert condition met.
{{plot_X}}: Value of a specific plot (e.g., {{plot_0}} for the first plot() output). More complex for strategy-specific info.
Strategy-Specific Placeholders (as defined in the script's alert message inputs):
{{lbu_info}}: Information about the LBU entry.
{{sl_level}}: Stop loss level.
{{tp_level}}: Take profit level.
{{bottom_score}}: Buy score.
{{ratio}}%: LBU ratio percentage.
{{ts_type}}: Type of trailing stop hit.
{{ts_level}}: Trailing stop level.
{{tp_num}}: Take profit level number (for multi-level TP).
{{top_score}}: Sell score for peak detection.
{{peak_reason}}: Reason for peak detection sell.
Setting up Alerts in TradingView:
Click the "Alert" icon (clock) in TradingView's right-hand toolbar or on the script's name on the chart.
Condition: Select "DUP V12B".
Choose the specific alert condition you want (e.g., "Buy", "Sell", or any custom alert setup via alertcondition() if you were to add them – though strategies typically use strategy.entry, strategy.exit, strategy.close_all which can trigger alerts). For strategies, you often select the script name and then the specific entry/exit condition provided by TradingView (e.g., "Order fills and alert function calls").
Trigger: "Once Per Bar Close" is generally recommended for strategies to avoid premature signals based on intra-bar price fluctuations.
Alert Actions: Choose how you want to be notified (Notify on app, Show pop-up, Send email, Webhook URL, etc.).
Message: You can use the default messages from the script's input settings or craft your own using the placeholders.
To use the script's dynamic messages for strategy alerts, you typically use {{strategy.order.alert_message}} in the TradingView alert message box if the strategy call (like strategy.entry) includes an alert_message parameter. Since this script defines alert templates in inputs but doesn't explicitly pass them to strategy.entry/order via alert_message parameter in the provided code, you'd manually copy your desired template from the script's input into the TradingView alert message box, replacing placeholders as needed for what TradingView offers natively for strategies.
Example Alert Message (manual setup in TradingView alert dialog for a buy):
{{ticker}} DUP V12 BUY | LBU: {{strategy.order.comment}} | Price: {{strategy.order.price}} | SL: CheckScript | TP: CheckScript
(Note: Accessing exact dynamic SL/TP levels directly in strategy.order.alert_message without them being part of the order comment or a dedicated alert variable can be tricky. Often, the comment field is used, or you set separate alerts for SL/TP breaches if possible.)
For strategy alerts, it's often best to rely on the "Order Fill" alerts and use the comment field of your strategy.entry or strategy.close_all calls to pass dynamic information, then reference {{strategy.order.comment}} in your alert message.
Backtesting and Optimization
Thorough Backtesting: Before trading live, extensively backtest DUP V12B on various financial instruments (stocks, forex, crypto, etc.) and timeframes.
Parameter Optimization:
Adjust LBU ratios, stop-loss percentages, take-profit targets, and indicator lengths based on the specific asset's volatility and your risk tolerance.
The Advanced and Premium modes offer many parameters to fine-tune. Start with Advanced before moving to Premium.
max_bars_back: The script requests 1000 bars of historical data (max_bars_back=1000). Ensure your chart has sufficient data for accurate calculations, especially for longer-term indicators.
Commission & Slippage: The script includes settings for commission_value (e.g., 0.15%) and slippage (in ticks). Adjust these to reflect your actual trading costs for more realistic backtest results.
Troubleshooting & Tips
No Signals/Lines:
Check "COMMON SETTINGS - Display & UI" to ensure shapes and lines are enabled.
Verify that the features you expect to see signals from are enabled in your chosen Operation Mode (Basic, Advanced, or Premium settings).
Momentum Candles Not Displaying Correctly: Ensure you have hidden the original chart candles from TradingView's main chart settings (Style -> untick Body, Borders, Wick).
Start Simple: Begin with Basic or Advanced mode to understand the fundamental behavior before venturing into the Premium settings.
Read Tooltips: Hover over the input settings in the script's configuration panel. Many options have tooltips (in Vietnamese in the original script, but their function is described here) explaining their purpose.
Dashboard is Your Friend: Keep an eye on the on-chart dashboard (if enabled) for a quick status check of the script's internal state.
Helen Trend RegimeGreatness starts from a tiny step forward.
This indicator combines EMA as a directional signal, BBWP as a volatility signal, and Volume Z-score as an volume signal to mark the market status: either in up trend, down trend, range, or in transition.
Dual Candle Engulfing (Classic + Heikin Ashi) Indicators based on ris deviations and characteristic K-line patterns
Candlestick IdentifierThis indicator is useful for identifying 11 common candlestick patterns. Candlestick patterns shouldn't be used for entries on their own, but they are a great confluence to validate other trade ideas. Some values can be adjusted to change the indicator's sensitivity depending on how stringent you want the defining candlestick parameters to be.
EMA Cross Signal Dashboard V4Amazing Scanner for demo useAmazing Scanner for demo useAmazing Scanner for demo useAmazing Scanner for demo useAmazing Scanner for demo useAmazing Scanner for demo use
Key Candle Re-Entry ZonesTime zone markups for the 1:25 & 9:25 times. This helps build identity for the pre-market and market analysis
5 Min ORB with ExtensionsThis Indicator marks the first RTH 5 minute high and low with the extensions levels
Sticky Candlestick Quarter Divider (Dynamic Update)This indicator divides the most recent candlestick into four equal parts and dynamically plots horizontal lines that move along with the latest candle.
Features:
Dynamic Sticky Lines:
The lines remain visually attached to the current candle, moving seamlessly as the chart updates, zooms, or pans.
Price Level Calculation:
Divides the candlestick into four distinct levels:
High Line (Red): Marks the highest point of the candle.
Low Line (Red): Marks the lowest point of the candle.
Midpoint Line (Blue): Marks the midpoint between high and low.
Upper Quarter Line (Green): Marks the 25% level between low and high.
Lower Quarter Line (Green): Marks the 75% level between low and high.
Real-Time Update:
The lines automatically adjust to the latest candle, maintaining accurate positioning.
Ideal for Candle Analysis:
Quickly identify key price levels and candle structure.
Suitable for analyzing trend strength and potential price reversals.
EMA 9/21 Cross Alerts with RSI Filter and Push AlertsSirve para compra y venta de futuros en 5m. Se entra cuand la EMA9 cruza hacia arriba la EMA 21.
Any Divergence for Many Indicators v6The community-based modification of the Divergence for Many Indicators v4 version has been upgraded to Pine Script v6, with the addition of 3 integrated alert signals. These alerts can simultaneously trigger notifications for both top and bottom divergences, fully utilizing the alert conditions of the watchlist.