Pine Scriptยฎ indicator
Search in scripts for "mtf"
MTF EMA Combo with Background ColorDaily/Weekly EMA combo for longer term trend direction, with combo background color for varying trend direction.
Pine Scriptยฎ indicator
MTF Polarity Grid [DW]This is an experimental study designed to track directional polarities across multiple timeframes and express them as a simple two color grid.
The polarity in this calculation is determined by divergence between a fast and slow McGinley Dynamic.
Your current resolution's polarity is the top row, the rows below are are for higher timeframes of your choice.
Pine Scriptยฎ indicator
MTF EMAExponential Moving Average indicator that can be configured to display different timeframe EMA's.
Timeframe is set in minutes. Max timeframe currently is the daily (1440 minutes). Any value higher than 1440 will result in no plot.
Examples:
Daily 50 EMA plotted on 4H chart
4H 50 EMA and Daily 50 EMA plotted on 1H chart
Can also work in reverse if needed.
Example, Daily 50 EMA plotted on Weekly Chart
Pine Scriptยฎ indicator
MTF CCI_8_34_5m_30minThis indicator is used in NimblrTA for plotting the following:
CCI-8 on 5 minutes
CCI-34 on 5 minutes
CCI-34 on 30 minutes interval on 5 minutes
Pine Scriptยฎ indicator
MTF Previous Open/Close/RangeThis indicator will simply plot on your chart the Daily/Weekly/Monthly previous candle levels.
The "Auto" mode will allow automatic adjustment of timeframe displayed according to your chart.
Otherwise you can select manually.
Indicator plots the open/close and colors the high-low range area in the background.
Hope this simple indicator will help you !
You can check my indicators via my TradingView's Profile : @PRO_Indicators
Pine Scriptยฎ indicator
Pine Scriptยฎ indicator
Pine Scriptยฎ indicator
GreenPen 1.2GreenPen MTF Confirmation
Multi-timeframe price action indicator for M1 scalping (XAUUSD)
How It Works
Draws a range box based on 7AM (GMT+7) candle open ยฑ offset
Detects Bullish/Bearish Engulfing with wick rejection at range edges
Optional Higher TF trend filter (EMA on H2/H4)
Optional M5 confirmation โ requires both M1 and M5 PA to align
Signals
๐ข๐ด Circle โ Raw Engulf + Wick (unfiltered, for reference)
๐บ B / S Triangle โ Filtered entry at range edge
๐ Rocket โ MTF BUY Confirmed (M1 + M5 bullish PA aligned)
๐จ Hammer โ MTF SELL Confirmed (M1 + M5 bearish PA aligned)
SL / TP
SL placed beyond range edge + ATR buffer
TP calculated using Risk:Reward ratio (default 1:2)
Settings
Range offset โ distance from 7AM open to draw upper/lower box
Edge zone % โ how much of the range counts as "edge" for entries
Trend filter โ toggle higher TF EMA trend filter on/off
MTF confirm โ toggle M5 confirmation on/off
Lookback โ how many M1 bars to check for M5 PA alignment
Recommended
Timeframe: M1
Symbol: XAUUSD
Trend TF: H2 or H4
Pine Scriptยฎ indicator
FVG Premium [no1x]โโOVERVIEW
This indicator provides a comprehensive toolkit for identifying, visualizing, and tracking Fair Value Gaps (FVGs) across three distinct timeframes (current chart, a user-defined Medium Timeframe - MTF, and a user-defined High Timeframe - HTF). It is designed to offer traders enhanced insight into FVG dynamics through detailed state monitoring (formation, partial fill, full mitigation, midline touch), extensive visual customization for FVG representation, and a rich alert system for timely notifications on FVG-related events.
โโCONCEPTS
This indicator is built upon the core concept of Fair Value Gaps (FVGs) and their significance in price action analysis, offering a multi-layered approach to their detection and interpretation across different timeframes.
Fair Value Gaps (FVGs)
A Fair Value Gap (FVG), also known as an imbalance, represents a range in price delivery where one side of the market (buying or selling) was more aggressive, leaving an inefficiency or an "imbalance" in the price action. This concept is prominently featured within Smart Money Concepts (SMC) and Inner Circle Trader (ICT) methodologies, where such gaps are often interpreted as footprints left by "smart money" due to rapid, forceful price movements. These methodologies suggest that price may later revisit these FVG zones to rebalance a prior inefficiency or to seek liquidity before continuing its path. These gaps are typically identified by a three-bar pattern:
Bullish FVG : This is a three-candle formation where the second candle shows a strong upward move. The FVG is the space created between the high of the first candle (bottom of FVG) and the low of the third candle (top of FVG). This indicates a strong upward impulsive move.
Bearish FVG : This is a three-candle formation where the second candle shows a strong downward move. The FVG is the space created between the low of the first candle (top of FVG) and the high of the third candle (bottom of FVG). This indicates a strong downward impulsive move.
FVGs are often watched by traders as potential areas where price might return to "rebalance" or find support/resistance.
Multi-Timeframe (MTF) Analysis
The indicator extends FVG detection beyond the current chart's timeframe (Low Timeframe - LTF) to two higher user-defined timeframes: Medium Timeframe (MTF) and High Timeframe (HTF). This allows traders to:
Identify FVGs that might be significant on a broader market structure.
Observe how FVGs from different timeframes align or interact.
Gain a more comprehensive perspective on potential support and resistance zones.
FVG State and Lifecycle Management
The indicator actively tracks the lifecycle of each detected FVG:
Formation : The initial identification of an FVG.
Partial Fill (Entry) : When price enters but does not completely pass through the FVG. The indicator updates the "current" top/bottom of the FVG to reflect the filled portion.
Midline (Equilibrium) Touch : When price touches the 50% level of the FVG.
Full Mitigation : When price completely trades through the FVG, effectively "filling" or "rebalancing" the gap. The indicator records the mitigation time.
This state tracking is crucial for understanding how price interacts with these zones.
FVG Classification (Large FVG)
FVGs can be optionally classified as "Large FVGs" (LV) if their size (top to bottom range) exceeds a user-defined multiple of the Average True Range (ATR) for that FVG's timeframe. This helps distinguish FVGs that are significantly larger relative to recent volatility.
Visual Customization and Information Delivery
A key concept is providing extensive control over how FVGs are displayed. This control is achieved through a centralized set of visual parameters within the indicator, allowing users to configure numerous aspects (colors, line styles, visibility of boxes, midlines, mitigation lines, labels, etc.) for each timeframe. Additionally, an on-chart information panel summarizes the nearest unmitigated bullish and bearish FVG levels for each active timeframe, providing a quick glance at key price points.
โโFEATURES
This indicator offers a rich set of features designed to provide a highly customizable and comprehensive Fair Value Gap (FVG) analysis experience. Users can tailor the FVG detection, visual representation, and alerting mechanisms across three distinct timeframes: the current chart (Low Timeframe - LTF), a user-defined Medium Timeframe (MTF), and a user-defined High Timeframe (HTF).
Multi-Timeframe FVG Detection and Display
The core strength of this indicator lies in its ability to identify and display FVGs from not only the current chart's timeframe (LTF) but also from two higher, user-selectable timeframes (MTF and HTF).
Timeframe Selection: Users can specify the exact MTF (e.g., "60", "240") and HTF (e.g., "D", "W") through dedicated inputs in the "MTF (Medium Timeframe)" and "HTF (High Timeframe)" settings groups. The visibility of FVGs from these higher timeframes can be toggled independently using the "Show MTF FVGs" and "Show HTF FVGs" checkboxes.
Consistent Detection Logic: The FVG detection logic, based on the classic three-bar imbalance pattern detailed in the 'Concepts' section, is applied consistently across all selected timeframes (LTF, MTF, HTF)
Timeframe-Specific Visuals: Each timeframe's FVGs (LTF, MTF, HTF) can be customized with unique colors for bullish/bearish states and their mitigated counterparts. This allows for easy visual differentiation of FVGs originating from different market perspectives.
Comprehensive FVG Visualization Options
The indicator provides extensive control over how FVGs are visually represented on the chart for each timeframe (LTF, MTF, HTF).
FVG Boxes:
Visibility: Main FVG boxes can be shown or hidden per timeframe using the "Show FVG Boxes" (for LTF), "Show Boxes" (for MTF/HTF) inputs.
Color Customization: Colors for bullish, bearish, active, and mitigated FVG boxes (including Large FVGs, if classified) are fully customizable for each timeframe.
Box Extension & Length: FVG boxes can either be extended to the right indefinitely ("Extend Boxes Right") or set to a fixed length in bars ("Short Box Length" or "Box Length" equivalent inputs).
Box Labels: Optional labels can display the FVG's timeframe and fill percentage on the box. These labels are configurable for all timeframes (LTF, MTF, and HTF). Please note: If FVGs are positioned very close to each other on the chart, their respective labels may overlap. This can potentially lead to visual clutter, and it is a known behavior in the current version of the indicator.
Box Borders: Visibility, width, style (solid, dashed, dotted), and color of FVG box borders are customizable per timeframe.
Midlines (Equilibrium/EQ):
Visibility: The 50% level (midline or EQ) of FVGs can be shown or hidden for each timeframe.
Style Customization: Width, style, and color of the midline are customizable per timeframe. The indicator tracks if this midline has been touched by price.
Mitigation Lines:
Visibility: Mitigation lines (representing the FVG's opening level that needs to be breached for full mitigation) can be shown or hidden for each timeframe. If shown, these lines are always extended to the right.
Style Customization: Width, style, and color of the mitigation line are customizable per timeframe.
Mitigation Line Labels: Optional price labels can be displayed on mitigation lines, with a customizable horizontal bar offset for positioning. For optimal label placement, the following horizontal bar offsets are recommended: 4 for LTF, 8 for MTF, and 12 for HTF.
Persistence After Mitigation: Users can choose to keep mitigation lines visible even after an FVG is fully mitigated, with a distinct color for such lines. Importantly, this option is only effective if the general setting 'Hide Fully Mitigated FVGs' is disabled, as otherwise, the entire FVG and its lines will be removed upon mitigation.
FVG State Management and Behavior
The indicator tracks and visually responds to changes in FVG states.
Hide Fully Mitigated FVGs: This option, typically found in the indicator's general settings, allows users to automatically remove all visual elements of an FVG from the chart once price has fully mitigated it. This helps maintain chart clarity by focusing on active FVGs.
Partial Fill Visualization: When price enters an FVG, the indicator offers a dynamic visual representation: the portion of the FVG that has been filled is shown as a "mitigated box" (typically with a distinct color), while the original FVG box shrinks to clearly highlight the remaining, unfilled portion. This two-part display provides an immediate visual cue about how much of the FVG's imbalance has been addressed and what potential remains within the gap.
Visual Filtering by ATR Proximity: To help users focus on the most relevant price action, FVGs can be dynamically hidden if they are located further from the current price than a user-defined multiple of the Average True Range (ATR). This behavior is controlled by the "Filter Band Width (ATR Multiple)" input; setting this to zero disables the filter entirely, ensuring all detected FVGs remain visible regardless of their proximity to price.
Alternative Usage Example: Mitigation Lines as Key Support/Resistance Levels
For traders preferring a minimalist chart focused on key Fair Value Gap (FVG) levels, the indicator's visualization settings can be customized to display only FVG mitigation lines. This approach leverages these lines as potential support and resistance zones, reflecting areas where price might revisit to address imbalances.
To configure this view:
Disable FVG Boxes: Turn off "Show FVG Boxes" (for LTF) or "Show Boxes" (for MTF/HTF) for the desired timeframes.
Hide Midlines: Disable the visibility of the 50% FVG Midlines (Equilibrium/EQ).
Ensure Mitigation Lines are Visible: Keep "Mitigation Lines" enabled.
Retain All Mitigation Lines:
Disable the "Hide Fully Mitigated FVGs" option in the general settings.
Enable the feature to "keep mitigation lines visible even after an FVG is fully mitigated". This ensures lines from all FVGs (active or fully mitigated) remain on the chart, which is only effective if "Hide Fully Mitigated FVGs" is disabled.
This setup offers:
A Decluttered Chart: Focuses solely on the FVG opening levels.
Precise S/R Zones: Treats mitigation lines as specific points for potential price reactions.
Historical Level Analysis: Includes lines from past, fully mitigated FVGs for a comprehensive view of significant price levels.
For enhanced usability with this focused view, consider these optional additions:
The on-chart Information Panel can be activated to display a quick summary of the nearest unmitigated FVG levels.
Mitigation Line Labels can also be activated for clear price level identification. A customizable horizontal bar offset is available for positioning these labels; for example, offsets of 4 for LTF, 8 for MTF, and 12 for HTF can be effective.
FVG Classification (Large FVG)
This feature allows for distinguishing FVGs based on their size relative to market volatility.
Enable Classification: Users can enable "Classify FVG (Large FVG)" to identify FVGs that are significantly larger than average.
ATR-Based Threshold: An FVG is classified as "Large" if its height (price range) is greater than or equal to the Average True Range (ATR) of its timeframe multiplied by a user-defined "Large FVG Threshold (ATR Multiple)". The ATR period for this calculation is also configurable.
Dedicated Colors: Large FVGs (both bullish/bearish and active/mitigated) can be assigned unique colors, making them easily distinguishable on the chart.
Panel Icon: Large FVGs are marked with a special icon in the Info Panel.
Information Panel
An on-chart panel provides a quick summary of the nearest unmitigated FVG levels.
Visibility and Position: The panel can be shown/hidden and positioned in any of the nine standard locations on the chart (e.g., Top Right, Middle Center).
Content: It displays the price levels of the nearest unmitigated bullish and bearish FVGs for LTF, MTF (if active), and HTF (if active). It also indicates if these nearest FVGs are Large FVGs (if classification is enabled) using a selectable icon.
Styling: Text size, border color, header background/text colors, default text color, and "N/A" cell background color are customizable.
Highlighting: Background and text colors for the cells displaying the overall nearest bullish and bearish FVG levels (across all active timeframes) can be customized to draw attention to the most proximate FVG.
Comprehensive Alert System
The indicator offers a granular alert system for various FVG-related events, configurable for each timeframe (LTF, MTF, HTF) independently. Users can enable alerts for:
New FVG Formation: Separate alerts for new bullish and new bearish FVG formations.
FVG Entry/Partial Fill: Separate alerts for price entering a bullish FVG or a bearish FVG.
FVG Full Mitigation: Separate alerts for full mitigation of bullish and bearish FVGs.
FVG Midline (EQ) Touch: Separate alerts for price touching the midline of a bullish or bearish FVG.
Alert messages are detailed, providing information such as the timeframe, FVG type (bull/bear, Large FVG), relevant price levels, and timestamps.
โโNOTES
This section provides additional information regarding the indicator's usage, performance considerations, and potential interactions with the TradingView platform. Understanding these points can help users optimize their experience and troubleshoot effectively.
Performance and Resource Management
Maximum FVGs to Track : The "Max FVGs to Track" input (defaulting to 25) limits the number of FVG objects processed for each category (e.g., LTF Bullish, MTF Bearish). Increasing this value significantly can impact performance due to more objects being iterated over and potentially drawn, especially when multiple timeframes are active.
Drawing Object Limits : To manage performance, this script sets its own internal limits on the number of drawing objects it displays. While it allows for up to approximately 500 lines (max_lines_count=500) and 500 labels (max_labels_count=500), the number of FVG boxes is deliberately restricted to a maximum of 150 (max_boxes_count=150). This specific limit for boxes is a key performance consideration: displaying too many boxes can significantly slow down the indicator, and a very high number is often not essential for analysis. Enabling all visual elements for many FVGs across all three timeframes can cause the indicator to reach these internal limits, especially the stricter box limit
Optimization Strategies : To help you manage performance, reduce visual clutter, and avoid exceeding drawing limits when using this indicator, I recommend the following strategies:
Maintain or Lower FVG Tracking Count: The "Max FVGs to Track" input defaults to 25. I find this value generally sufficient for effective analysis and balanced performance. You can keep this default or consider reducing it further if you experience performance issues or prefer a less dense FVG display.
Utilize Proximity Filtering: I suggest activating the "Filter Band Width (ATR Multiple)" option (found under "General Settings") to display only those FVGs closer to the current price. From my experience, a value of 5 for the ATR multiple often provides a good starting point for balanced performance, but you should feel free to adjust this based on market volatility and your specific trading needs.
Hide Fully Mitigated FVGs: I strongly recommend enabling the "Hide Fully Mitigated FVGs" option. This setting automatically removes all visual elements of an FVG from the chart once it has been fully mitigated by price. Doing so significantly reduces the number of active drawing objects, lessens computational load, and helps maintain chart clarity by focusing only on active, relevant FVGs.
Disable FVG Display for Unused Timeframes: If you are not actively monitoring certain higher timeframes (MTF or HTF) for FVG analysis, I advise disabling their display by unchecking "Show MTF FVGs" or "Show HTF FVGs" respectively. This can provide a significant performance boost.
Simplify Visual Elements: For active FVGs, consider hiding less critical visual elements if they are not essential for your specific analysis. This could include box labels, borders, or even entire FVG boxes if, for example, only the mitigation lines are of interest for a particular timeframe.
Settings Changes and Platform Limits : This indicator is comprehensive and involves numerous calculations and drawings. When multiple settings are changed rapidly in quick succession, it is possible, on occasion, for TradingView to issue a "Runtime error: modify_study_limit_exceeding" or similar. This can cause the indicator to temporarily stop updating or display errors.
Recommended Approach : When adjusting settings, it is advisable to wait a brief moment (a few seconds) after each significant change. This allows the indicator to reprocess and update on the chart before another change is made
Error Recovery : Should such a runtime error occur, making a minor, different adjustment in the settings (e.g., toggling a checkbox off and then on again) and waiting briefly will typically allow the indicator to recover and resume correct operation. This behavior is related to platform limitations when handling complex scripts with many inputs and drawing objects.
Multi-Timeframe (MTF/HTF) Data and Behavior
HTF FVG Confirmation is Essential: : For an FVG from a higher timeframe (MTF or HTF) to be identified and displayed on your current chart (LTF), the three-bar pattern forming the FVG on that higher timeframe must consist of fully closed bars. The indicator does not draw speculative FVGs based on incomplete/forming bars from higher timeframes.
Data Retrieval and LTF Processing: The indicator may use techniques like lookahead = barmerge.lookahead_on for timely data retrieval from higher timeframes. However, the actual detection of an FVG occurs after all its constituent bars on the HTF have closed.
Appearance Timing on LTF (1 LTF Candle Delay): As a natural consequence of this, an FVG that is confirmed on an HTF (i.e., its third bar closes) will typically become visible on your LTF chart one LTF bar after its confirmation on the HTF.
Example: Assume an FVG forms on a 30-minute chart at 15:30 (i.e., with the close of the 30-minute bar that covers the 15:00-15:30 period). If you are monitoring this FVG on a 15-minute chart, the indicator will detect this newly formed 30-minute FVG while processing the data for the 15-minute bar that starts at 15:30 and closes at 15:45. Therefore, the 30-minute FVG will become visible on your 15-minute chart at the earliest by 15:45 (i.e., with the close of that relevant 15-minute LTF candle). This means the HTF FVG is reflected on the LTF chart with a delay equivalent to one LTF candle.
FVG Detection and Display Logic
Fair Value Gaps (FVGs) on the current chart timeframe (LTF) are detected based on barstate.isconfirmed. This means the three-bar pattern must be complete with closed bars before an FVG is identified. This confirmation method prevents FVGs from being prematurely identified on the forming bar.
Alerts
Alert Setup : To receive alerts from this indicator, you must first ensure you have enabled the specific alert conditions you are interested in within the indicator's own settings (see 'Comprehensive Alert System' under the 'FEATURES' section). Once configured, open TradingView's 'Create Alert' dialog. In the 'Condition' tab, select this indicator's name, and crucially, choose the 'Any alert() function call' option from the dropdown list. This setup allows the indicator to trigger alerts based on the precise event conditions you have activated in its settings
Alert Frequency : Alerts are designed to trigger once per bar close (alert.freq_once_per_bar_close) for the specific event.
User Interface (UI) Tips
Settings Group Icons: In the indicator settings menu, timeframe-specific groups are marked with star icons for easier navigation: ๐ for LTF (Current Chart Timeframe), ๐๐ for MTF (Medium Timeframe), and ๐๐๐ for HTF (High Timeframe).
Dependent Inputs: Some input settings are dependent on others being enabled. These dependencies are visually indicated in the settings menu using symbols like "โณ" (dependent setting on the next line), "โท" (mutually exclusive inline options), or "โ" (directly dependent inline option).
Settings Layout Overview: The indicator settings are organized into logical groups for ease of use. Key global display controls โ such as toggles for MTF FVGs, HTF FVGs (along with their respective timeframe selectors), and the Information Panel โ are conveniently located at the very top within the 'โ๏ธ General Settings' group. This placement allows for quick access to frequently adjusted settings. Other sections provide detailed customization options for each timeframe (LTF, MTF, HTF), specific FVG components, and alert configurations.
โโFOR Pine Scriptยฎ CODERS
This section provides a high-level overview of the FVG Premium indicator's internal architecture, data flow, and the interaction between its various library components. It is intended for Pine Scriptโข programmers who wish to understand the indicator's design, potentially extend its functionality, or learn from its structure.
System Architecture and Modular Design
The indicator is architected moduarly, leveraging several custom libraries to separate concerns and enhance code organization and reusability. Each library has a distinct responsibility:
FvgTypes: Serves as the foundational data definition layer. It defines core User-Defined Types (UDTs) like fvgObject (for storing all attributes of an FVG) and drawSettings (for visual configurations), along with enumerations like tfType.
CommonUtils: Provides utility functions for common tasks like mapping user string inputs (e.g., "Dashed" for line style) to their corresponding Pine Scriptโข constants (e.g., line.style_dashed) and formatting timeframe strings for display.
FvgCalculations: Contains the core logic for FVG detection (both LTF and MTF/HTF via requestMultiTFBarData), FVG classification (Large FVGs based on ATR), and checking FVG interactions with price (mitigation, partial fill).
FvgObject: Implements an object-oriented approach by attaching methods to the fvgObject UDT. These methods manage the entire visual lifecycle of an FVG on the chart, including drawing, updating based on state changes (e.g., mitigation), and deleting drawing objects. It's responsible for applying the visual configurations defined in drawSettings.
FvgPanel: Manages the creation and dynamic updates of the on-chart information panel, which displays key FVG levels.
The main indicator script acts as the orchestrator, initializing these libraries, managing user inputs, processing data flow between libraries, and handling the main event loop (bar updates) for FVG state management and alerts.
Core Data Flow and FVG Lifecycle Management
The general data flow and FVG lifecycle can be summarized as follows:
Input Processing: User inputs from the "Settings" dialog are read by the main indicator script. Visual style inputs (colors, line styles, etc.) are consolidated into a types.drawSettings object (defined in FvgTypes). Other inputs (timeframes, filter settings, alert toggles) control the behavior of different modules. CommonUtils assists in mapping some string inputs to Pine constants.
FVG Detection:
For the current chart timeframe (LTF), FvgCalculations.detectFvg() identifies potential FVGs based on bar patterns.
For MTF/HTF, the main indicator script calls FvgCalculations.requestMultiTFBarData() to fetch necessary bar data from higher timeframes, then FvgCalculations.detectMultiTFFvg() identifies FVGs.
Newly detected FVGs are instantiated as types.fvgObject and stored in arrays within the main script. These objects also undergo classification (e.g., Large FVG) by FvgCalculations.
State Update & Interaction: On each bar, the main indicator script iterates through active FVG objects to manage their state based on price interaction:
Initially, the main script calls FvgCalculations.fvgInteractionCheck() to efficiently determine if the current bar's price might be interacting with a given FVG.
If a potential interaction is flagged, the main script then invokes methods directly on the fvgObject instance (e.g., updateMitigation(), updatePartialFill(), checkMidlineTouch(), which are part of FvgObject).
These fvgObject methods are responsible for the detailed condition checking and the actual modification of the FVG's state. For instance, the updateMitigation() and updatePartialFill() methods internally utilize specific helper functions from FvgCalculations (like checkMitigation() and checkPartialMitigation()) to confirm the precise nature of the interaction before updating the fvgObjectโs state fields (such as isMitigated, currentTop, currentBottom, or isMidlineTouched).
Visual Rendering:
The FvgObject.updateDrawings() method is called for each fvgObject. This method is central to drawing management; it creates, updates, or deletes chart drawings (boxes, lines, labels) based on the FVG's current state, its prev_* (previous bar state) fields for optimization, and the visual settings passed via the drawSettings object.
Information Panel Update: The main indicator script determines the nearest FVG levels, populates a panelData object (defined in FvgPanelLib), and calls FvgPanel.updatePanel() to refresh the on-chart display.
Alert Generation: Based on the updated FVG states and user-enabled alert settings, the main indicator script constructs and triggers alerts using Pine Script's alert() function."
Key Design Considerations
UDT-Centric Design: The fvgObject UDT is pivotal, acting as a stateful container for all information related to a single FVG. Most operations revolve around creating, updating, or querying these objects.
State Management: To optimize drawing updates and manage FVG lifecycles, fvgObject instances store their previous bar's state (e.g., prevIsVisible, prevCurrentTop). The FvgObject.updateDrawings() method uses this to determine if a redraw is necessary, minimizing redundant drawing calls.
Settings Object: A drawSettings object is populated once (or when inputs change) and passed to drawing functions. This avoids repeatedly reading numerous input() values on every bar or within loops, improving performance.
Dynamic Arrays for FVG Storage: Arrays are used to store collections of fvgObject instances, allowing for dynamic management (adding new FVGs, iterating for updates).
Pine Scriptยฎ indicator
PA SystemPA System - Price Action Trading System
ไปทๆ ผ่กไธบไบคๆ็ณป็ป
๐ ๆฆ่ฟฐ / Overview
PA System is a comprehensive price action trading indicator that combines Smart Money Concepts (SMC), market structure analysis, and multi-timeframe confirmation to identify high-probability trade setups. Designed for both manual traders and algorithmic trading systems.
PA System ๆฏไธไธช็ปผๅๆงไปทๆ ผ่กไธบไบคๆๆๆ ๏ผ็ปๅไบSmart Moneyๆฆๅฟต(SMC)ใๅธๅบ็ปๆๅๆๅๅคๆถ้ดๆกๆถ็กฎ่ฎค๏ผ็จไบ่ฏๅซ้ซๆฆ็ไบคๆๆบไผใ้็จไบๆๅจไบคๆ่
ๅ็ฎๆณไบคๆ็ณป็ปใ
โจ ๆ ธๅฟ็นๆง / Key Features
๐ฏ Four-Phase Signal System / ๅ้ถๆฎตไฟกๅท็ณป็ป
H1 (First Pullback) - Initial bullish retracement in uptrend
H2 (Confirmed Entry) - Breakout confirmation for long entries
L1 (First Bounce) - Initial bearish bounce in downtrend
L2 (Confirmed Entry) - Breakdown confirmation for short entries
ไธญๆ่ฏดๆ๏ผ
H1๏ผ้ฆๆฌกๅ่ฐ๏ผ - ไธๅ่ถๅฟไธญ็ๅๆฌกๅๆคไฟกๅท
H2๏ผ็กฎ่ฎคๅ
ฅๅบ๏ผ - ็ช็ ด็กฎ่ฎค็ๅๅคๅ
ฅๅบ็น
L1๏ผ้ฆๆฌกๅๅผน๏ผ - ไธ้่ถๅฟไธญ็ๅๆฌกๅๅผนไฟกๅท
L2๏ผ็กฎ่ฎคๅ
ฅๅบ๏ผ - ่ท็ ด็กฎ่ฎค็ๅ็ฉบๅ
ฅๅบ็น
๐ Market Structure Detection / ๅธๅบ็ปๆ่ฏๅซ
HH (Higher High) - Uptrend confirmation / ไธๅ่ถๅฟ็กฎ่ฎค
HL (Higher Low) - Bullish pullback / ๅคๅคดๅ่ฐ
LH (Lower High) - Bearish bounce / ็ฉบๅคดๅๅผน
LL (Lower Low) - Downtrend confirmation / ไธ้่ถๅฟ็กฎ่ฎค
๐ Smart Money Concepts (SMC) / ๆบ่ฝ่ต้ๆฆๅฟต
BoS (Break of Structure) - Trend continuation signal / ่ถๅฟๅปถ็ปญไฟกๅท
CHoCH (Change of Character) - Potential trend reversal / ๆฝๅจ่ถๅฟๅ่ฝฌ
๐ Dynamic Trendlines / ๅจๆ่ถๅฟ็บฟ
Auto-drawn support and resistance trendlines / ่ชๅจ็ปๅถๆฏๆ้ปๅ่ถๅฟ็บฟ
Real-time extension to current bar / ๅฎๆถๅปถไผธ่ณๅฝๅK็บฟ
Slope-filtered for accuracy / ๆ็่ฟๆปค็กฎไฟๅ็กฎๆง
๐๏ธ Multi-Timeframe Analysis / ๅคๆถ้ดๆกๆถๅๆ
Higher timeframe trend filter (default 4H) / ๅคงๅจๆ่ถๅฟ่ฟๆปค๏ผ้ป่ฎค4ๅฐๆถ๏ผ
Prevents counter-trend trades / ้ฒๆญข้ๅฟไบคๆ
Configurable timeframe / ๅฏ้
็ฝฎๆถ้ดๅจๆ
๐ Volume Confirmation / ๆไบค้็กฎ่ฎค
Filters signals based on volume strength / ๅบไบๆไบค้ๅผบๅบฆ่ฟๆปคไฟกๅท
20-period volume MA comparison / ไธ20ๆๆไบค้ๅ็บฟๅฏนๆฏ
High-volume bars highlighted / ้ซๆไบค้K็บฟ้ซไบฎๆพ็คบ
๐ฏ Risk Management Tools / ้ฃ้ฉ็ฎก็ๅทฅๅ
ท
Automatic SL/TP calculation and display / ่ชๅจ่ฎก็ฎๅนถๆพ็คบๆญขๆๆญข็
Visual stop loss and take profit lines / ๅฏ่งๅๆญขๆๆญข็็บฟๆก
Risk percentage and R:R ratio display / ๆพ็คบ้ฃ้ฉ็พๅๆฏๅ็ไบๆฏ
Dynamic stop loss sizing (0.3% - 1.5%) / ๅจๆๆญขๆ่ๅด๏ผ0.3% - 1.5%๏ผ
๐ฑ Real-Time Alerts / ๅฎๆถ่ญฆๆฅ
Instant notifications on H2/L2 signals / H2/L2ไฟกๅทๅณๆถ้็ฅ
Webhook support for automation / ๆฏๆWebhook่ชๅจๅ
Mobile, email, and popup alerts / ๆๆบใ้ฎไปถๅๅผน็ช่ญฆๆฅ
๐ Professional Dashboard / ไธไธไปช่กจ็
Real-time market state (CHANNEL/RANGE/BREAKOUT) / ๅฎๆถๅธๅบ็ถๆ
Local and MTF trend indicators / ๆฌๅฐๅๅคงๅจๆ่ถๅฟๆๆ
Order flow status (HIGH VOL / LOW VOL) / ่ฎขๅๆต็ถๆ
Last signal tracker / ๆๆฐไฟกๅท่ฟฝ่ธช
๐ง ๅๆฐ่ฎพ็ฝฎ / Parameter Settings
Structure Settings / ็ปๆ่ฎพ็ฝฎ
Parameter Default Range Description
Swing Length / ๆๅจ้ฟๅบฆ 5 2-20 Pivot detection sensitivity / ๆข่ฝด็นๆฃๆต็ตๆๅบฆ
Trend Confirm Bars / ่ถๅฟ็กฎ่ฎคๆ นๆฐ 3 2-10 Consecutive bars for breakout / ็ช็ ดๆ้่ฟ็ปญK็บฟๆฐ
Channel ATR Mult / ้้ATRๅๆฐ 2.0 1.0-5.0 Range detection threshold / ๅบ้ดๆฃๆต้ๅผ
Signal Settings / ไฟกๅท่ฎพ็ฝฎ
Parameter Default Description
Enable H2 Longs / ๅฏ็จH2ๅๅค โ
Toggle long signals / ๅผๅ
ณๅๅคไฟกๅท
Enable L2 Shorts / ๅฏ็จL2ๅ็ฉบ โ
Toggle short signals / ๅผๅ
ณๅ็ฉบไฟกๅท
Micro Range Length / ๅพฎๅนณๅฐ้ฟๅบฆ 3 Breakout detection bars / ็ช็ ดๆฃๆตK็บฟๆฐ
Close Strength / ๆถ็ๅผบๅบฆ 0.6 Minimum close position in bar / K็บฟๅ
ๆๅฐๆถ็ไฝ็ฝฎ
Filter Settings / ่ฟๆปค่ฎพ็ฝฎ
Parameter Default Description
Use MTF Filter / ๅคงๅจๆ่ฟๆปค โ
Enable higher timeframe filter / ๅฏ็จๅคงๅจๆ่ฟๆปค
MTF Timeframe / ๅคงๅจๆๆถ้ดๆกๆถ 240 (4H) Higher timeframe period / ๅคงๅจๆๆถ้ด
Use Volume Filter / ๆไบค้่ฟๆปค โ
Require high volume confirmation / ้่ฆ้ซๆไบค้็กฎ่ฎค
Volume MA Length / ๆไบค้ๅ็บฟๅจๆ 20 Volume comparison period / ๆไบค้ๅฏนๆฏๅจๆ
Fast EMA / ๅฟซ้EMA 20 Short-term trend / ็ญๆ่ถๅฟ
Slow EMA / ๆ
ข้EMA 50 Long-term trend / ้ฟๆ่ถๅฟ
Risk Management / ้ฃ้ฉ็ฎก็
Parameter Default Description
Risk % / ้ฃ้ฉ็พๅๆฏ 1.0% Risk per trade / ๆฏ็ฌไบคๆ้ฃ้ฉ
R:R Ratio / ็ไบๆฏ 2.0 Reward to risk ratio / ็ไบๆฏ็
Max SL ATR / ๆๅคงๆญขๆATR 3.0 Maximum stop loss in ATR / ๆๅคงๆญขๆATRๅๆฐ
Min SL % / ๆๅฐๆญขๆ็พๅๆฏ 0.3% Minimum stop loss percentage / ๆๅฐๆญขๆ็พๅๆฏ
Max SL % / ๆๅคงๆญขๆ็พๅๆฏ 1.5% Maximum stop loss percentage / ๆๅคงๆญขๆ็พๅๆฏ
๐ ไฝฟ็จๆนๆณ / How to Use
1. ๅบ็ก่ฎพ็ฝฎ / Basic Setup
For Day Trading (5-15 min charts) / ๆฅๅ
ไบคๆ๏ผ5-15ๅ้ๅพ๏ผ
text
Swing Length: 5
MTF Timeframe: 240 (4H)
Risk %: 1.0%
R:R: 2.0
For Swing Trading (1-4H charts) / ๆณขๆฎตไบคๆ๏ผ1-4ๅฐๆถๅพ๏ผ
text
Swing Length: 8
MTF Timeframe: D (Daily)
Risk %: 0.5%
R:R: 3.0
For Scalping (1-5 min charts) / ๅฅๅคด็ฎ๏ผ1-5ๅ้ๅพ๏ผ
text
Swing Length: 3
MTF Timeframe: 60 (1H)
Risk %: 0.5%
R:R: 1.5
Use Volume Filter: โ
2. ไฟกๅท่ฏๅซ / Signal Identification
Long Entry / ๅๅคๅ
ฅๅบ
โ
Dashboard shows "Local Trend: BULL" / ไปช่กจ็ๆพ็คบ"ๆฌๅฐ่ถๅฟ๏ผๅคๅคด"
โ
MTF Trend shows "BULLISH" / ๅคงๅจๆ่ถๅฟๆพ็คบ"็ๆถจ"
โ
Green circle (H1) appears below bar / ็ปฟ่ฒๅ็น(H1)ๅบ็ฐๅจK็บฟไธๆน
โณ Wait for H2 signal (green triangle โฒ) / ็ญๅพ
H2ไฟกๅท๏ผ็ปฟ่ฒไธ่งโฒ๏ผ
๐ Check volume bar is cyan (HIGH VOL) / ๆฃๆฅๆไบค้ๆฑไธบ้่ฒ๏ผ้ซๆไบค้๏ผ
๐ฏ Enter at close of H2 bar / ๅจH2 K็บฟๆถ็ไปทๅ
ฅๅบ
๐ก๏ธ Set SL at red dashed line / ๆญขๆ่ฎพๅจ็บข่ฒ่็บฟไฝ็ฝฎ
๐ Set TP at green dashed line / ๆญข็่ฎพๅจ็ปฟ่ฒ่็บฟไฝ็ฝฎ
Short Entry / ๅ็ฉบๅ
ฅๅบ
โ
Dashboard shows "Local Trend: BEAR" / ไปช่กจ็ๆพ็คบ"ๆฌๅฐ่ถๅฟ๏ผ็ฉบๅคด"
โ
MTF Trend shows "BEARISH" / ๅคงๅจๆ่ถๅฟๆพ็คบ"็่ท"
โ
Red circle (L1) appears above bar / ็บข่ฒๅ็น(L1)ๅบ็ฐๅจK็บฟไธๆน
โณ Wait for L2 signal (red triangle โผ) / ็ญๅพ
L2ไฟกๅท๏ผ็บข่ฒๅไธ่งโผ๏ผ
๐ Check volume bar is cyan (HIGH VOL) / ๆฃๆฅๆไบค้ๆฑไธบ้่ฒ๏ผ้ซๆไบค้๏ผ
๐ฏ Enter at close of L2 bar / ๅจL2 K็บฟๆถ็ไปทๅ
ฅๅบ
๐ก๏ธ Set SL at red dashed line / ๆญขๆ่ฎพๅจ็บข่ฒ่็บฟไฝ็ฝฎ
๐ Set TP at green dashed line / ๆญข็่ฎพๅจ็ปฟ่ฒ่็บฟไฝ็ฝฎ
3. ่ญฆๆฅ่ฎพ็ฝฎ / Alert Setup
Step-by-Step / ๅๆญฅๆไฝ
Click the "โฐ" alert icon on chart / ็นๅปๅพ่กจไธ็"โฐ"่ญฆๆฅๅพๆ
Select "PA System - Indicator Version" / ้ๆฉ"PA System (V1.1) - Indicator Version"
Condition: "Any alert() function call" / ๆกไปถ๏ผ้ๆฉ"Any alert() function call"
Choose notification method: / ้ๆฉ้็ฅๆนๅผ๏ผ
๐ฑ Mobile Push / ๆๆบๆจ้
๐ง Email / ้ฎไปถ
๐ Webhook URL (for automation) / Webhook็ฝๅ๏ผ็จไบ่ชๅจๅ๏ผ
Set frequency: "Once Per Bar Close" / ้ข็๏ผ้ๆฉ"Once Per Bar Close"
Click "Create" / ็นๅป"ๅๅปบ"
Webhook Example for IBKR API / IBKR API็Webhook็คบไพ
json
{
"signal": "{{strategy.order.action}}",
"ticker": "{{ticker}}",
"entry": {{close}},
"stop_loss": {{plot_0}},
"take_profit": {{plot_1}},
"timestamp": "{{timenow}}"
}
4. ไบคๆ็ฎก็ / Trade Management
Position Sizing / ไปไฝ่ฎก็ฎ
text
Account: $10,000
Risk per Trade: 1% = $100
Entry Price: $690.45
Stop Loss: $687.38
Risk per Share: $690.45 - $687.38 = $3.07
Position Size: $100 / $3.07 = 32 shares
Partial Profit Taking / ้จๅๆญข็
Close 50% position at 1:1 R:R / ๅจ1:1็ไบๆฏๆถๅนณไป50%
Move SL to breakeven / ็งปๅจๆญขๆ่ณไฟๆฌไฝ
Let remaining 50% run to 2R target / ่ฎฉๅฉไฝ50%่ทๅ2R็ฎๆ
๐จ ่ง่งๅ
็ด ่ฏดๆ / Visual Elements Guide
Chart Markers / ๅพ่กจๆ ่ฎฐ
Symbol Color Meaning
โซ Small Circle / ๅฐๅ็น ๐ข Green / ็ปฟ่ฒ H1 - First bullish pullback / ้ฆๆฌกๅคๅคดๅ่ฐ
โฒ Triangle / ไธ่งๅฝข ๐ข Green / ็ปฟ่ฒ H2 - Confirmed long entry / ็กฎ่ฎคๅๅคๅ
ฅๅบ
โซ Small Circle / ๅฐๅ็น ๐ด Red / ็บข่ฒ L1 - First bearish bounce / ้ฆๆฌก็ฉบๅคดๅๅผน
โผ Inverted Triangle / ๅไธ่ง ๐ด Red / ็บข่ฒ L2 - Confirmed short entry / ็กฎ่ฎคๅ็ฉบๅ
ฅๅบ
Structure Labels / ็ปๆๆ ็ญพ
Label Position Meaning
HH Above high / ้ซ็นไธๆน Higher High - Bullish / ๆด้ซ็้ซ็น-็ๆถจ
HL Below low / ไฝ็นไธๆน Higher Low - Bullish / ๆด้ซ็ไฝ็น-็ๆถจ
LH Above high / ้ซ็นไธๆน Lower High - Bearish / ๆดไฝ็้ซ็น-็่ท
LL Below low / ไฝ็นไธๆน Lower Low - Bearish / ๆดไฝ็ไฝ็น-็่ท
BoS/CHoCH Lines / ็ ดไฝ็บฟๆก
Type Color Width Meaning
BoS ๐ต Teal / ้่ฒ 2px Break of Structure - Trend continues / ็ปๆ็ช็ ด-่ถๅฟๅปถ็ปญ
CHoCH ๐ด Red / ็บข่ฒ 2px Change of Character - Trend reversal / ๆง่ดจๆนๅ-่ถๅฟๅ่ฝฌ
Trendlines / ่ถๅฟ็บฟ
Type Color Style Meaning
Bullish / ็ๆถจ ๐ต Teal / ้่ฒ Solid / ๅฎ็บฟ Uptrend support / ไธๅ่ถๅฟๆฏๆ
Bearish / ็่ท ๐ด Red / ็บข่ฒ Solid / ๅฎ็บฟ Downtrend resistance / ไธ้่ถๅฟ้ปๅ
Risk Lines / ้ฃ้ฉ็บฟๆก
Type Color Style Meaning
Stop Loss / ๆญขๆ ๐ด Red / ็บข่ฒ Dashed / ่็บฟ Suggested stop loss level / ๅปบ่ฎฎๆญขๆไฝ
Take Profit / ๆญข็ ๐ข Green / ็ปฟ่ฒ Dashed / ่็บฟ Suggested take profit level / ๅปบ่ฎฎๆญข็ไฝ
Dashboard Colors / ไปช่กจ็้ข่ฒ
Status Color Meaning
BULL / ๅคๅคด ๐ข Green / ็ปฟ่ฒ Bullish trend / ็ๆถจ่ถๅฟ
BEAR / ็ฉบๅคด ๐ด Red / ็บข่ฒ Bearish trend / ็่ท่ถๅฟ
NEUTRAL / ไธญๆง โช Gray / ็ฐ่ฒ No clear trend / ๆ ๆ็กฎ่ถๅฟ
BREAKOUT / ็ช็ ด ๐ก Lime / ้ป็ปฟ Strong momentum / ๅผบๅฒๅจ่ฝ
HIGH VOL / ้ซๆไบค้ ๐ต Cyan / ้่ฒ High volume confirmation / ้ซๆไบค้็กฎ่ฎค
๐ก ไบคๆ็ญ็ฅๅปบ่ฎฎ / Trading Strategy Tips
โ
High Probability Setups / ้ซๆฆ็่ฎพ็ฝฎ
Trend Alignment / ่ถๅฟไธ่ด
Local Trend = BULL + MTF Trend = BULLISH / ๆฌๅฐๅคๅคด + ๅคงๅจๆ็ๆถจ
Or: Local Trend = BEAR + MTF Trend = BEARISH / ๆ๏ผๆฌๅฐ็ฉบๅคด + ๅคงๅจๆ็่ท
Volume Confirmation / ๆไบค้็กฎ่ฎค
H2/L2 signal appears with cyan volume bar / H2/L2ไฟกๅทไผด้้่ฒๆไบค้ๆฑ
Volume > 20-period MA / ๆไบค้ > 20ๆๅ็บฟ
Trendline Support / ่ถๅฟ็บฟๆฏๆ
H2 appears near bullish trendline / H2ๅบ็ฐๅจ็ๆถจ่ถๅฟ็บฟ้่ฟ
L2 appears near bearish trendline / L2ๅบ็ฐๅจ็่ท่ถๅฟ็บฟ้่ฟ
BoS Confirmation / BoS็กฎ่ฎค
Recent BoS in same direction / ๆ่ฟๅๆนๅ็BoS
No CHoCH against the trade / ๆ ้ๅ็CHoCH
โ Avoid These Setups / ้ฟๅ
่ฟไบๆ
ๅต
Conflicting Trends / ่ถๅฟๅฒ็ช
Local BULL but MTF BEARISH / ๆฌๅฐๅคๅคดไฝๅคงๅจๆ็่ท
Market State = RANGE / ๅธๅบ็ถๆ = ๅบ้ด
Low Volume / ไฝๆไบค้
Order Flow shows "LOW VOL" / ่ฎขๅๆตๆพ็คบ"ไฝๆไบค้"
Volume bar is red (below MA) / ๆไบค้ๆฑไธบ็บข่ฒ๏ผไฝไบๅ็บฟ๏ผ
Against Trendline / ้่ถๅฟ็บฟ
Shorting at bullish trendline support / ๅจ็ๆถจ่ถๅฟ็บฟๆฏๆๅคๅ็ฉบ
Buying at bearish trendline resistance / ๅจ็่ท่ถๅฟ็บฟ้ปๅๅคๅๅค
Recent CHoCH / ่ฟๆCHoCH
CHoCH appeared within 10 bars / 10ๆ นK็บฟๅ
ๅบ็ฐCHoCH
Potential trend reversal zone / ๆฝๅจ่ถๅฟๅ่ฝฌๅบๅ
๐ ไผๅๅปบ่ฎฎ / Optimization Tips
For Different Markets / ้ๅฏนไธๅๅธๅบ
Stocks / ่ก็ฅจ
text
Swing Length: 5-8
MTF: 240 (4H) or D (Daily)
Risk %: 0.5-1.0%
Best on: SPY, QQQ, AAPL, TSLA
Forex / ๅคๆฑ
text
Swing Length: 5
MTF: 240 (4H)
Risk %: 1.0-2.0%
Best on: EUR/USD, GBP/USD, USD/JPY
Use Volume Filter: OFF (Forex volume is unreliable)
Crypto / ๅ ๅฏ่ดงๅธ
text
Swing Length: 3-5
MTF: 240 (4H)
Risk %: 0.5-1.0% (high volatility)
Max SL %: 2.0-3.0%
Best on: BTC, ETH, SOL
Futures / ๆ่ดง
text
Swing Length: 5
MTF: 240 (4H)
Risk %: 1.0-1.5%
Best on: ES, NQ, RTY, CL
๐ค ่ชๅจๅ้ๆ / Automation Integration
Python + IBKR API Example / Python + IBKR API็คบไพ
python
import requests
from ib_insync import *
def handle_tradingview_alert(alert_data):
"""
Receives webhook from TradingView alert
ๆฅๆถๆฅ่ชTradingView่ญฆๆฅ็webhook
"""
signal = alert_data # "H2 LONG" or "L2 SHORT"
ticker = alert_data # "SPY"
entry = alert_data # 690.45
stop_loss = alert_data # 687.38
take_profit = alert_data # 696.59
# Connect to IBKR
ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)
# Create contract
contract = Stock(ticker, 'SMART', 'USD')
# Calculate position size (1% risk)
account_value = ib.accountValues() .value
risk_amount = float(account_value) * 0.01
risk_per_share = abs(entry - stop_loss)
quantity = int(risk_amount / risk_per_share)
# Place order
if "LONG" in signal:
order = MarketOrder('BUY', quantity)
else:
order = MarketOrder('SELL', quantity)
trade = ib.placeOrder(contract, order)
# Set stop loss and take profit
ib.placeOrder(contract, StopOrder('SELL', quantity, stop_loss))
ib.placeOrder(contract, LimitOrder('SELL', quantity, take_profit))
ib.disconnect()
TradersPost Integration / TradersPost้ๆ
Create TradersPost account / ๅๅปบTradersPost่ดฆๆท
Connect IBKR broker / ่ฟๆฅIBKRๅธๅ
Get Webhook URL / ่ทๅWebhook็ฝๅ
Add to TradingView alert / ๆทปๅ ๅฐTradingView่ญฆๆฅ
Test with paper trading / ็จๆจกๆ่ดฆๆทๆต่ฏ
๐ ๆง่ฝๆๆ / Performance Metrics
Expected Performance (Backtested) / ้ขๆ่กจ็ฐ๏ผๅๆต๏ผ
Metric Value Notes
Win Rate / ่็ 60-75% With all filters enabled / ๅฏ็จๆๆ่ฟๆปคๅจ
Avg R:R / ๅนณๅ็ไบๆฏ 1.8-2.2 Using 2R target / ไฝฟ็จ2R็ฎๆ
Max Drawdown / ๆๅคงๅๆค 8-12% 1% risk per trade / ๆฏ็ฌ1%้ฃ้ฉ
Profit Factor / ็ๅฉๅ ๅญ 1.8-2.5 Trend-following bias / ่ถๅฟ่ท้ๅๅ
Best Markets / ๆไฝณๅธๅบ Trending Avoid ranging markets / ้ฟๅ
ๅบ้ดๅธๅบ
โ ๏ธ Disclaimer: Past performance does not guarantee future results. Always test in paper trading first.
โ ๏ธ ๅ
่ดฃๅฃฐๆ๏ผๅๅฒ่กจ็ฐไธไฟ่ฏๆชๆฅ็ปๆใ่ฏทๅ
ๅจๆจกๆ่ดฆๆทๆต่ฏใ
๐ ๏ธ ๆ
้ๆ้ค / Troubleshooting
Problem: No signals appearing / ้ฎ้ข๏ผๆฒกๆไฟกๅทๅบ็ฐ
Solution / ่งฃๅณๆนๆก:
Disable MTF Filter temporarily / ๆๆถๅ
ณ้ญๅคงๅจๆ่ฟๆปค
Disable Volume Filter / ๅ
ณ้ญๆไบค้่ฟๆปค
Reduce Swing Length to 3 / ๅฐๆๅจ้ฟๅบฆ้่ณ3
Check if market is ranging (no clear trend) / ๆฃๆฅๅธๅบๆฏๅฆๅคไบๅบ้ด๏ผๆ ๆ็กฎ่ถๅฟ๏ผ
Problem: Too many signals / ้ฎ้ข๏ผไฟกๅทๅคชๅค
Solution / ่งฃๅณๆนๆก:
Enable MTF Filter / ๅฏ็จๅคงๅจๆ่ฟๆปค
Enable Volume Filter / ๅฏ็จๆไบค้่ฟๆปค
Increase Swing Length to 8 / ๅฐๆๅจ้ฟๅบฆๅข่ณ8
Enable Break Filter / ๅฏ็จ็ ดไฝ่ฟๆปค
Problem: Alerts not working / ้ฎ้ข๏ผ่ญฆๆฅไธๅทฅไฝ
Solution / ่งฃๅณๆนๆก:
Check "Enable Alerts" is ON / ๆฃๆฅ"ๅฏ็จ่ญฆๆฅ"ๅทฒๅผๅฏ
Verify alert condition is "Any alert() function call" / ็กฎ่ฎค่ญฆๆฅๆกไปถไธบ"Any alert() function call"
Check notification settings in TradingView / ๆฃๆฅTradingView้็ฅ่ฎพ็ฝฎ
Test alert with "Test" button / ็จ"ๆต่ฏ"ๆ้ฎๆต่ฏ่ญฆๆฅ
Problem: SL/TP lines not showing / ้ฎ้ข๏ผๆญขๆๆญข็็บฟไธๆพ็คบ
Solution / ่งฃๅณๆนๆก:
Enable "Show SL/TP Labels" in settings / ๅจ่ฎพ็ฝฎไธญๅฏ็จ"ๆพ็คบๆญขๆๆญข็ๆ ็ญพ"
Check if signal is recent (lines expire after 10 bars) / ๆฃๆฅไฟกๅทๆฏๅฆ่ฟๆ๏ผ็บฟๆกๅจ10ๆ นK็บฟๅๆถๅคฑ๏ผ
Zoom in to see lines more clearly / ๆพๅคงๅพ่กจไปฅๆดๆธ
ๆฅๅฐ็ๅฐ็บฟๆก
๐ ๅธธ่ง้ฎ้ข FAQ
Q1: Can I use this on any timeframe? / ๅฏไปฅๅจไปปไฝๆถ้ดๆกๆถไฝฟ็จๅ๏ผ
A: Yes, but works best on 5min-4H charts. Recommended: 15min (day trading), 1H (swing trading).
ๅฏไปฅ๏ผไฝๅจ5ๅ้-4ๅฐๆถๅพ่กจๆๆๆไฝณใๆจ่๏ผ15ๅ้๏ผๆฅๅ
ไบคๆ๏ผ๏ผ1ๅฐๆถ๏ผๆณขๆฎตไบคๆ๏ผใ
Q2: Do I need to enable all filters? / ้่ฆๅฏ็จๆๆ่ฟๆปคๅจๅ๏ผ
A: No. Start with all enabled, then disable based on your risk tolerance. MTF filter is highly recommended.
ไธ้่ฆใไปๅ
จ้จๅฏ็จๅผๅง๏ผ็ถๅๆ นๆฎ้ฃ้ฉๆฟๅ่ฝๅ็ฆ็จใๅผบ็ๆจ่MTF่ฟๆปคๅจใ
Q3: Can I automate this with IBKR? / ๅฏไปฅไธIBKR่ชๅจๅๅ๏ผ
A: Yes! Use TradingView alerts + Webhook + Python script + IBKR API. See automation example above.
ๅฏไปฅ๏ผไฝฟ็จTradingView่ญฆๆฅ + Webhook + Python่ๆฌ + IBKR APIใๅ่งไธๆน่ชๅจๅ็คบไพใ
Q4: What's the difference between Strategy and Indicator version? / ็ญ็ฅ็ๅๆๆ ็ๆไปไนๅบๅซ๏ผ
A: Strategy = backtesting only. Indicator = real-time alerts + automation. Use both: backtest with strategy, trade with indicator.
็ญ็ฅ็=ไป
ๅๆตใๆๆ ็=ๅฎๆถ่ญฆๆฅ+่ชๅจๅใไธค่
็ปๅไฝฟ็จ๏ผ็จ็ญ็ฅ็ๅๆต๏ผ็จๆๆ ็ไบคๆใ
Q5: Why does H2 appear but no trade? / ไธบไปไนๅบ็ฐH2ไฝๆฒกๆไบคๆ๏ผ
A: This is an indicator, not a strategy. You need to manually place orders or use automation via alerts.
่ฟๆฏๆๆ ๏ผไธๆฏ็ญ็ฅใไฝ ้่ฆๆๅจไธๅๆ้่ฟ่ญฆๆฅไฝฟ็จ่ชๅจๅใ
โ๏ธ ๅ
่ดฃๅฃฐๆ / Disclaimer
IMPORTANT / ้่ฆๆ็คบ:
This indicator is for educational purposes only. Trading involves substantial risk of loss. Past performance does not guarantee future results. Always:
ๆฌๆๆ ไป
ไพๆ่ฒ็ฎ็ใไบคๆๆถๅ้ๅคงไบๆ้ฃ้ฉใๅๅฒ่กจ็ฐไธไฟ่ฏๆชๆฅ็ปๆใ่ฏทๅกๅฟ
๏ผ
โ
Test in paper trading first / ๅ
ๅจๆจกๆ่ดฆๆทๆต่ฏ
โ
Use proper risk management (1-2% max per trade) / ไฝฟ็จ้ๅฝ้ฃ้ฉ็ฎก็๏ผๆฏ็ฌๆๅค1-2%๏ผ
โ
Never risk more than you can afford to lose / ๆฐธ่ฟไธ่ฆๅ่ถ
ๅบๆฟๅ่ฝๅ็้ฃ้ฉ
โ
Understand the strategy before using / ไฝฟ็จๅ็่งฃ็ญ็ฅๅ็
Not financial advice. Trade at your own risk.
้ๆ่ตๅปบ่ฎฎใไบคๆ้ฃ้ฉ่ช่ดใ
Pine Scriptยฎ indicator
Multi-Fibonacci Trend Average[FibonacciFlux]Multi-Fibonacci Trend Average (MFTA): An Institutional-Grade Trend Confluence Indicator for Discerning Market Participants
My original indicator/Strategy:
Engineered for the sophisticated demands of institutional and advanced traders, the Multi-Fibonacci Trend Average (MFTA) indicator represents a paradigm shift in technical analysis. This meticulously crafted tool is designed to furnish high-definition trend signals within the complexities of modern financial markets. Anchored in the rigorous principles of Fibonacci ratios and augmented by advanced averaging methodologies, MFTA delivers a granular perspective on trend dynamics. Its integration of Multi-Timeframe (MTF) filters provides unparalleled signal robustness, empowering strategic decision-making with a heightened degree of confidence.
MFTA indicator on BTCUSDT 15min chart with 1min RSI and MACD filters enabled. Note the refined signal generation with reduced noise.
MFTA indicator on BTCUSDT 15min chart without MTF filters. While capturing more potential trading opportunities, it also generates a higher frequency of signals, including potential false positives.
Core Innovation: Proprietary Fibonacci-Enhanced Supertrend Averaging Engine
The MFTA indicatorโs core innovation lies in its proprietary implementation of Supertrend analysis, strategically fortified by Fibonacci ratios to construct a truly dynamic volatility envelope. Departing from conventional Supertrend methodologies, MFTA autonomously computes not one, but three distinct Supertrend lines. Each of these lines is uniquely parameterized by a specific Fibonacci factor: 0.618 (Weak), 1.618 (Medium/Golden Ratio), and 2.618 (Strong/Extended Fibonacci).
// Fibonacci-based factors for multiple Supertrend calculations
factor1 = input.float(0.618, 'Factor 1 (Weak/Fibonacci)', minval=0.01, step=0.01, tooltip='Factor 1 (Weak/Fibonacci)', group="Fibonacci Supertrend")
factor2 = input.float(1.618, 'Factor 2 (Medium/Golden Ratio)', minval=0.01, step=0.01, tooltip='Factor 2 (Medium/Golden Ratio)', group="Fibonacci Supertrend")
factor3 = input.float(2.618, 'Factor 3 (Strong/Extended Fib)', minval=0.01, step=0.01, tooltip='Factor 3 (Strong/Extended Fib)', group="Fibonacci Supertrend")
This multi-faceted architecture adeptly captures a spectrum of market volatility sensitivities, ensuring a comprehensive assessment of prevailing conditions. Subsequently, the indicator algorithmically synthesizes these disparate Supertrend lines through arithmetic averaging. To achieve optimal signal fidelity and mitigate inherent market noise, this composite average is further refined utilizing an Exponential Moving Average (EMA).
// Calculate average of the three supertends and a smoothed version
superlength = input.int(21, 'Smoothing Length', tooltip='Smoothing Length for Average Supertrend', group="Fibonacci Supertrend")
average_trend = (supertrend1 + supertrend2 + supertrend3) / 3
smoothed_trend = ta.ema(average_trend, superlength)
The resultant โSmoothed Trendโ line emerges as a remarkably responsive yet stable trend demarcation, offering demonstrably superior clarity and precision compared to singular Supertrend implementations, particularly within the turbulent dynamics of high-volatility markets.
Elevated Signal Confluence: Integrated Multi-Timeframe (MTF) Validation Suite
MFTA transcends the limitations of conventional trend indicators by incorporating an advanced suite of three independent MTF filters: RSI, MACD, and Volume. These filters function as sophisticated validation protocols, rigorously ensuring that only signals exhibiting a confluence of high-probability factors are brought to the forefront.
1. Granular Lower Timeframe RSI Momentum Filter
The Relative Strength Index (RSI) filter, computed from a user-defined lower timeframe, furnishes critical momentum-based signal validation. By meticulously monitoring RSI dynamics on an accelerated timeframe, traders gain the capacity to evaluate underlying momentum strength with precision, prior to committing to signal execution on the primary chart timeframe.
// --- Lower Timeframe RSI Filter ---
ltf_rsi_filter_enable = input.bool(false, title="Enable RSI Filter", group="MTF Filters", tooltip="Use RSI from lower timeframe as a filter")
ltf_rsi_timeframe = input.timeframe("1", title="RSI Timeframe", group="MTF Filters", tooltip="Timeframe for RSI calculation")
ltf_rsi_length = input.int(14, title="RSI Length", minval=1, group="MTF Filters", tooltip="Length for RSI calculation")
ltf_rsi_threshold = input.int(30, title="RSI Threshold", minval=0, maxval=100, group="MTF Filters", tooltip="RSI value threshold for filtering signals")
2. Convergent Lower Timeframe MACD Trend-Momentum Filter
The Moving Average Convergence Divergence (MACD) filter, also calculated on a lower timeframe basis, introduces a critical layer of trend-momentum convergence confirmation. The bullish signal configuration rigorously mandates that the MACD line be definitively positioned above the Signal line on the designated lower timeframe. This stringent condition ensures a robust indication of converging momentum that aligns synergistically with the prevailing trend identified on the primary timeframe.
// --- Lower Timeframe MACD Filter ---
ltf_macd_filter_enable = input.bool(false, title="Enable MACD Filter", group="MTF Filters", tooltip="Use MACD from lower timeframe as a filter")
ltf_macd_timeframe = input.timeframe("1", title="MACD Timeframe", group="MTF Filters", tooltip="Timeframe for MACD calculation")
ltf_macd_fast_length = input.int(12, title="MACD Fast Length", minval=1, group="MTF Filters", tooltip="Fast EMA length for MACD")
ltf_macd_slow_length = input.int(26, title="MACD Slow Length", minval=1, group="MTF Filters", tooltip="Slow EMA length for MACD")
ltf_macd_signal_length = input.int(9, title="MACD Signal Length", minval=1, group="MTF Filters", tooltip="Signal SMA length for MACD")
3. Definitive Volume Confirmation Filter
The Volume Filter functions as an indispensable arbiter of trade conviction. By establishing a dynamic volume threshold, defined as a percentage relative to the average volume over a user-specified lookback period, traders can effectively ensure that all generated signals are rigorously validated by demonstrably increased trading activity. This pivotal validation step signifies robust market participation, substantially diminishing the potential for spurious or false breakout signals.
// --- Volume Filter ---
volume_filter_enable = input.bool(false, title="Enable Volume Filter", group="MTF Filters", tooltip="Use volume level as a filter")
volume_threshold_percent = input.int(title="Volume Threshold (%)", defval=150, minval=100, group="MTF Filters", tooltip="Minimum volume percentage compared to average volume to allow signal (100% = average)")
These meticulously engineered filters operate in synergistic confluence, requiring all enabled filters to definitively satisfy their pre-defined conditions before a Buy or Sell signal is generated. This stringent multi-layered validation process drastically minimizes the incidence of false positive signals, thereby significantly enhancing entry precision and overall signal reliability.
Intuitive Visual Architecture & Actionable Intelligence
MFTA provides a demonstrably intuitive and visually rich charting environment, meticulously delineating trend direction and momentum through precisely color-coded plots:
Average Supertrend: Thin line, green/red for uptrend/downtrend, immediate directional bias.
Smoothed Supertrend: Bold line, teal/purple for uptrend/downtrend, cleaner, institutionally robust trend.
Dynamic Trend Fill: Green/red fill between Supertrends quantifies trend strength and momentum.
Adaptive Background Coloring: Light green/red background mirrors Smoothed Supertrend direction, holistic trend perspective.
Precision Buy/Sell Signals: โBUYโ/โSELLโ labels appear on chart when trend touch and MTF filter confluence are satisfied, facilitating high-conviction trade action.
MFTA indicator applied to BTCUSDT 4-hour chart, showcasing its effectiveness on higher timeframes. The Smoothed Length parameter is increased to 200 for enhanced smoothness on this timeframe, coupled with 1min RSI and Volume filters for signal refinement. This illustrates the indicator's adaptability across different timeframes and market conditions.
Strategic Applications for Institutional Mandates
MFTAโs sophisticated design provides distinct advantages for advanced trading operations and institutional investment mandates. Key strategic applications include:
High-Probability Trend Identification: Fibonacci-averaged Supertrend with MTF filters robustly identifies high-probability trend continuations and reversals, enhancing alpha generation.
Precision Entry/Exit Signals: Volume and momentum-filtered signals enable institutional-grade precision for optimized risk-adjusted returns.
Algorithmic Trading Integration: Clear signal logic facilitates seamless integration into automated trading systems for scalable strategy deployment.
Multi-Asset/Timeframe Versatility: Adaptable parameters ensure applicability across diverse asset classes and timeframes, catering to varied trading mandates.
Enhanced Risk Management: Superior signal fidelity from MTF filters inherently reduces false signals, supporting robust risk management protocols.
Granular Customization and Parameterized Control
MFTA offers unparalleled customization, empowering users to fine-tune parameters for precise alignment with specific trading styles and market conditions. Key adjustable parameters include:
Fibonacci Factors: Adjust Supertrend sensitivity to volatility regimes.
ATR Length: Control volatility responsiveness in Supertrend calculations.
Smoothing Length: Refine Smoothed Trend line responsiveness and noise reduction.
MTF Filter Parameters: Independently configure timeframes, lookback periods, and thresholds for RSI, MACD, and Volume filters for optimal signal filtering.
Disclaimer
MFTA is meticulously engineered for high-quality trend signals; however, no indicator guarantees profit. Market conditions are unpredictable, and trading involves substantial risk. Rigorous backtesting and forward testing across diverse datasets, alongside a comprehensive understanding of the indicator's logic, are essential before live deployment. Past performance is not indicative of future results. MFTA is for informational and analytical purposes only and is not financial or investment advice.
Pine Scriptยฎ indicator
cd_HTF_bias_CxOverview:
No matter our trading style or model, to increase our success rate, we must move in the direction of the trend and align with the Higher Time Frame (HTF). Trading "gurus" call this the HTF bias. While we small fish tend to swim in all directions, the smart way is to flow with the big wave and the current. This indicator is designed to help us anticipate that major wave.
________________________________________
Details and Usage:
This indicator observes HTF price action across preferably seven different pairs, following specific rules. It confirms potential directional moves using CISD levels on a Medium Time Frame (MTF). In short, it forecasts the likely direction (HTF bias). The user can then search for trade opportunities aligned with this bias on a Lower Time Frame (LTF), using their preferred pair, entry model, and style.
________________________________________
Timeframe Alignment:
The commonly accepted LTF/MTF/HTF combinations include:
โข 1m โ 15m โ H4
โข 3m โ H1 โ Daily / 3m โ 30m โ Daily
โข 5m โ H1 โ Daily
โข 15m โ H4 โ Weekly
โข H1 โ Daily โ Monthly
โข H4 โ Weekly โ Quarterly
Example: If you're trading with a 3m model on a 30m/3m setup, you should seek trades in the direction of the H1/Daily bias.
________________________________________
How It Works:
The indicator first looks for sweeps on the selected HTF โ when any of the last four candles are swept, the first condition is met.
The second step is confirmation with a CISD close on the MTF โ once a candle closes above/below the CISD level, the second condition is fulfilled. This suggests the price has made its directional decision.
Example: If a previous HTF candle is swept and we receive a bearish CISD confirmation on H1, the HTF bias becomes bearish.
After this, you may switch to a more granular setup like HTF: 30m and MTF: 3m to look for trade entries aligned with the bias (e.g., 30m sweep + 3m CISD).
________________________________________
How Is Bias Determined?
โข HTF Sweep + MTF CISD = SC (Sweep & CISD)
โข Latest Bullish SC โ Bias: Bullish
โข Latest Bearish SC โ Bias: Bearish
โข Price closes above the last Bearish SC โ Bias: Strong Bullish
โข Price closes below the last Bullish SC โ Bias: Strong Bearish
โข Strong Bullish bias + Bearish CISD (without HTF sweep) โ Bias: Bullish
โข Strong Bearish bias + Bullish CISD (without HTF sweep) โ Bias: Bearish
โข Bearish price violates SC high, but Bullish SC is untouched โ Bias: Bullish
โข Bullish price violates SC low, but Bearish SC is untouched โ Bias: Bearish
โข If neither side generates SC โ Bias: No Bias
The logic is built on the idea that a price overcoming resistance is stronger, and encountering resistance is weaker. This model is based on the well-known โDaily Biasโ structure, but with personal refinements.
________________________________________
Whatโs on the Screen?
โข Classic HTF zones (boxes)
โข Potential MTF CISD levels
โข Confirmed MTF lines
โข Sweep zones when HTF sweeps occur
โข Result table showing current bias status
________________________________________
Usage:
โข Select HTF and MTF timeframes aligned with your trading timeframe.
โข Adjust color and position settings as needed.
โข Enter up to seven pairs to track via the menu.
โข Use the checkbox next to each pair to enable/disable them.
โข If โIgnore these assetsโ is checked, all pairs will be disabled, and only the currently open chart pair will be tracked.
________________________________________
Alerts:
You can choose alerts for Bullish, Bearish, Strong Bullish, or Strong Bearish conditions.
There are two types of alert sources:
1. From the indicatorโs internal list
2. From TradingViewโs watchlist
Visual example:
________________________________________
How I Use It:
โข For spot trades, I use HTF: Weekly and MTF: H4 and look for Bullish or Strong Bullish pairs.
โข For scalping, I follow bias from HTF: Daily and MTF: H1.
Example: If the indicator shows a Bearish HTF Bias, I switch to HTF: 30m and MTF: 3m and enter trades once bearish conditions are met (timeframe alignment).
________________________________________
Important Notes:
โข The indicator defines CISD levels only at HTF high and low levels.
โข If your chart is on a higher timeframe than your selected HTF/MTF, no data will appear.
Example: If HTF = H1 and MTF = 5m, opening a chart on H4 will result in a blank screen.
โข The drawn CISD level on screen is the MTF CISD level.
โข Not every alert should be traded. Always confirm with personal experience and visual validation.
โข Receiving multiple Strong Bullish/Bearish alerts is intentional. (Trick ๐)
โข Please share your feedback and suggestions!
________________________________________
And Most Importantly:
Don't leave street animals without water and food!
Happy trading!
Pine Scriptยฎ indicator
EvoTrend-X Indicator โ Evolutionary Trend Learner ExperimentalEvoTrend-X Indicator โ Evolutionary Trend Learner
NOTE: This is an experimental Pine Script v6 port of a Python prototype. Pine wasnโt the original research language, so there may be small quirksโyour feedback and bug reports are very welcome. The model is non-repainting, MTF-safe (lookahead_off + gaps_on), and features an adaptive (fitness-based) candidate selector, confidence gating, and a volatility filter.
โธป
What it is
EvoTrend-X is adaptive trend indicator that learns which moving-average length best fits the current market. It maintains a small โpopulationโ of fast EMA candidates, rewards those that align with price momentum, and continuously selects the best performer. Signals are gated by a multi-factor Confidence score (fitness, strength vs. ATR, MTF agreement) and a volatility filter (ATR%). You get a clean Fast/Slow pair (for the currently best candidate), optional HTF filter, a fitness ribbon for transparency, and a themed info panel with a one-glance STATUS readout.
Core outputs
โข Selected Fast/Slow EMAs (auto-chosen from candidates via fitness learning)
โข Spread cross (Fast โ Slow) โ visual BUY/SELL markers + alert hooks
โข Confidence % (0โ100): Fitness โ Distance vs. ATR โ MTF agreement
โข Gates: Trend regime (Kaufman ER), Volatility (ATR%), MTF filter (optional)
โข Candidate Fitness Ribbon: shows which lengths the learner currently prefers
โข Export plot: hidden series โEvoTrend-X Export (spread)โ for downstream use
โธป
Why itโs different
โข Evolutionary learning (on-chart): Each candidate EMA length gets rewarded if its slope matches price change and penalized otherwise, with a gentle decay so the model forgets stale regimes. The best fitness wins the right to define the displayed Fast/Slow pair.
โข Confidence gate: Signals donโt light up unless multiple conditions concur: learned fitness, spread strength vs. volatility, and (optionally) higher-timeframe trend.
โข Volatility awareness: ATR% filter blocks low-energy environments that cause death-by-a-thousand-whipsaws. Your โwhy no signal?โ answer is always visible in the STATUS.
โข Preset discipline, Custom freedom: Presets set reasonable baselines for FX, equities, and crypto; Custom exposes all knobs and honors your inputs one-to-one.
โข Non-repainting rigor: All MTF calls use lookahead_off + gaps_on. Decisions use confirmed bars. No forward refs. No conditional ta.* pitfalls.
โธป
Presets (and what they do)
โข FX 1H (Conservative): Medium candidates, slightly higher MinConf, modest ATR% floor. Good for macro sessions and cleaner swings.
โข FX 15m (Active): Shorter candidates, looser MinConf, higher ATR% floor. Designed for intraday velocity and decisive sessions.
โข Equities 1D: Longer candidates, gentler volatility floor. Suits index/large-cap trend waves.
โข Crypto 1H: Mid-short candidates, higher ATR% floor for 24/7 chop, stronger MinConf to avoid noise.
โข Custom: Your inputs are used directly (no override). Ideal for systematic tuning or bespoke assets.
โธป
How the learning works (at a glance)
1. Candidates: A small set of fast EMA lengths (e.g., 8/12/16/20/26/34). Slow = Fast ร multiplier (default ร2.0).
2. Reward/decay: If price change and the candidateโs Fast slope agree (both up or both down), its fitness increases; otherwise decreases. A decay constant slowly forgets the distant past.
3. Selection: The candidate with highest fitness defines the displayed Fast/Slow pair.
4. Signal engine: Crosses of the spread (Fast โ Slow) across zero mark potential regime shifts. A Confidence score and gates decide whether to surface them.
โธป
Controls & what they mean
Learning / Regime
โข Slow length = Fast ร: scales the Slow EMA relative to each Fast candidate. Larger multiplier = smoother regime detection, fewer whipsaws.
โข ER length / threshold: Kaufman Efficiency Ratio; above threshold = โTrendingโ background.
โข Learning step, Decay: Larger step reacts faster to new behavior; decay sets how quickly the past is forgotten.
Confidence / Volatility gate
โข Min Confidence (%): Minimum score to show signals (and fire alerts). Raising it filters noise; lowering it increases frequency.
โข ATR length: The ATR window for both the ATR% filter and strength normalization. Shorter = faster, but choppier.
โข Min ATR% (percent): ATR as a percentage of price. If ATR% < Min ATR% โ status shows BLOCK: low vola.
MTF Trend Filter
โข Use HTF filter / Timeframe / Fast & Slow: HTF Fast>Slow for longs, Fast threshold; exit when spread flips or Confidence decays below your comfort zone.
2) FX index/majors, 15m (active intraday)
โข Preset: FX 15m (Active).
โข Gate: MinConf 60โ70; Min ATR% 0.15โ0.30.
โข Flow: Focus on session opens (LDN/NY). The ribbon should heat up on shorter candidates before valid crosses appearโgood early warning.
3) SPY / Index futures, 1D (positioning)
โข Preset: Equities 1D.
โข Gate: MinConf 55โ65; Min ATR% 0.05โ0.12.
โข Flow: Use spread crosses as regime flags; add timing from price structure. For adds, wait for ER to remain trending across several bars.
4) BTCUSD, 1H (24/7)
โข Preset: Crypto 1H.
โข Gate: MinConf 70โ80; Min ATR% 0.20โ0.35.
โข Flow: Crypto chopsโvolatility filter is your friend. When ribbon and HTF OK agree, favor continuation entries; otherwise stand down.
โธป
Reading the Info Panel (and fixing โno signalsโ)
The panel is your self-diagnostic:
โข HTF OK? False means the higher-timeframe EMAs disagree with your intended side.
โข Regime: If โChopโ, ER < threshold. Consider raising the threshold or waiting.
โข Confidence: Heat-colored; if below MinConf, the gate blocks signals.
โข ATR% vs. Min ATR%: If ATR% < Min ATR%, status shows BLOCK: low vola.
โข STATUS (composite):
โข BLOCK: low vola โ increase Min ATR% down (i.e., allow lower vol) or wait for expansion.
โข BLOCK: HTF filter โ disable HTF or align with the HTF tide.
โข BLOCK: confidence โ lower MinConf slightly or wait for stronger alignment.
โข OK โ youโll see markers on valid crosses.
โธป
Alerts
Two static alert hooks:
โข BUY cross โ spread crosses up and all gates (ER, Vol, MTF, Confidence) are open.
โข SELL cross โ mirror of the above.
Create them once from โAdd Alertโ โ choose the condition by name.
โธป
Exporting to other scripts
In your other Pine indicators/strategies, add an input.source and select EvoTrend-X โ โEvoTrend-X Export (spread)โ. Common uses:
โข Build a rule: only trade when exported spread > 0 (trend filter).
โข Combine with your oscillator: oscillator oversold and spread > 0 โ buy bias.
โธป
Best practices
โข Let it learn: Keep Learning step moderate (0.4โ0.6) and Decay close to 1.0 (e.g., 0.99โ0.997) for smooth regime memory.
โข Respect volatility: Tune Min ATR% by asset and timeframe. FX 1H โ 0.10โ0.20; crypto 1H โ 0.20โ0.35; equities 1D โ 0.05โ0.12.
โข MTF discipline: HTF filter removes lots of โalmostโ trades. If you prefer aggressive entries, turn it off and rely more on Confidence.
โข Confidence as throttle:
โข 40โ60%: exploratory; expect more signals.
โข 60โ75%: balanced; good daily driver.
โข 75โ90%: selective; catch the clean stuff.
โข 90โ100%: only A-setups; patient mode.
โข Watch the ribbon: When shorter candidates heat up before a cross, momentum is forming. If long candidates dominate, youโre in a slower trend cycle.
โธป
Non-repainting & safety notes
โข All request.security() calls use lookahead=barmerge.lookahead_off, gaps=barmerge.gaps_on.
โข No forward references; decisions rely on confirmed bar data.
โข EMA lengths are simple ints (no series-length errors).
โข Confidence components are computed every bar (no conditional ta.* traps).
โธป
Limitations & tips
โข Chop happens: ER helps, but sideways microstructure can still flickerโuse Confidence + Vol filter as brakes.
โข Presets โ oracle: Theyโre sensible baselines; always tune MinConf and Min ATR% to your venue and session.
โข Theme โAutoโ: Pine cannot read chart theme; โAutoโ defaults to a Dark-friendly palette.
โธป
Publisherโs Screenshots Checklist
1) FX swing โ EURUSD 1H
โข Preset: FX 1H (Conservative)
โข Params: MinConf=70, ATR Len=14, Min ATR%=0.12, MTF ON (TF=4H, 20/50)
โข Show: Clear BUY cross, STATUS=OK, green regime background; Fitness Ribbon visible.
2) FX intraday โ GBPUSD 15m
โข Preset: FX 15m (Active)
โข Params: MinConf=60, ATR Len=14, Min ATR%=0.20, MTF ON (TF=60m)
โข Show: SELL cross near London session open. HTF lines enabled (translucent).
โข Caption: โGBPUSD 15m โข Active session sell with MTF alignment.โ
3) Indices โ SPY 1D
โข Preset: Equities 1D
โข Params: MinConf=60, ATR Len=14, Min ATR%=0.08, MTF ON (TF=1W, 20/50)
โข Show: Longer trend run after BUY cross; regime shading shows persistence.
โข Caption: โSPY 1D โข Trend run after BUY cross; weekly filter aligned.โ
4) Crypto โ BINANCE:BTCUSDT 1H
โข Preset: Crypto 1H
โข Params: MinConf=75, ATR Len=14, Min ATR%=0.25, MTF ON (TF=4H)
โข Show: BUY cross + quick follow-through; Ribbon warming (reds/yellows โ greens).
โข Caption: โBTCUSDT 1H โข Momentum break with high confidence and ribbon turning.โ
Pine Scriptยฎ indicator
ATR%ๆๆจๆฆ่ฆ / Overview
ATR Percentage (MTF)๏ผๆ ATR ่ฝ็บ็พๅๆฏ๏ผATR%๏ผๆไฟ็็บ็ตๅฐๅผ๏ผไธฆๅจ่ฉฒใๆณขๅๅบๅใไธๅฅ็จๅธๆๅธถใๆฏๆดๅค้ฑๆ๏ผMTF๏ผ่จ็ฎ๏ผไพๅฆๅจ 5 ๅๅ้กฏ็คบ 4H / D1 ็ ATR%ใๅ
งๅปบ็ฝ่ฒ้ป็ๆฐดๅนณ็ทไฝ็บๅบๅฎ้ๆชป๏ผ้ ่จญ 1%๏ผใ
ATR Percentage (MTF): Converts ATR to a percentage of price (ATR%) or keeps it as absolute ATR, then applies Bollinger Bands on this volatility series. Supports multi-timeframe (MTF) calculation (e.g., show 4H/D1 ATR% on a 5-min chart). Includes a configurable white dotted horizontal threshold line (default 1%).
โธป
่จญ่จ็ฎ็ / Purpose
โข ไปฅ ATR% ่กก้็ธๅฐๆณขๅ๏ผๅฉๆผ่ทจๅ็จฎๆฏ่ผใ
Use ATR% for relative volatility to compare across markets.
โข ไปฅ ๅธๆๅธถ ๆจ็คบใ้ซ/ไฝๆณขๅๅใ๏ผ่งๅฏๆดๅผต่ๅฃ็ธฎใ
Use Bollinger Bands on volatility to highlight expansion/squeeze.
โข ๆไพ ๅบๅฎ้พๅผ๏ผ1%๏ผ ไฝ็บ็ญ็ฅๆฟพ็ถฒๆๅ่ญฆ้ๆชปใ
Provide a fixed threshold (1%) for filters/alerts.
โข ไปฅ MTF ๆนๅผ๏ผ่ฎไฝ้ฑๆ็ญ็ฅ็จ้ซ้ฑๆๆณขๅๅๆฟพ็ถฒใ
MTF lets lower-TF strategies filter by higher-TF volatility.
โธป
ๅๆธ่ชชๆ / Inputs
โข Use ATR as % of Close๏ผๅๆ ATR๏ผ็ตๅฐๅผ๏ผ/ ATR%๏ผๅปบ่ญฐ๏ผใ
Toggle between absolute ATR and ATR% (recommended).
โข ATR Periods๏ผATR ่จ็ฎ้ทๅบฆ๏ผ้ ่จญ 22๏ผใ
ATR lookback (default 22).
โข Show Bollinger Bands / BB Periods / StdDev๏ผๅธๆๅธถ้้ใ้ทๅบฆ่ๅๆธ๏ผ้ ่จญ 20 / 2๏ผใ
Bollinger Bands on/off, length, and deviation (default 20 / 2).
โข Source Timeframe๏ผ่จ็ฎ็จ้ฑๆ๏ผๅฆ 60ใ240ใDใW๏ผ็็ฉบ/Chart ๏ผ ่ท้จๅ่กจ๏ผใ
Timeframe used for calculations (e.g., 60, 240, D, W; empty/โChartโ = current).
โข Threshold Line (%)๏ผ็ฝ่ฒ้ป็ท้ๆชป๏ผ้ ่จญ 1.0๏ผๅณ 1%๏ผใ
White dotted threshold line, default 1.0 (1%).
ๆ้๏ผ็ถ ้ ATR% ๆจกๅผๆ๏ผThreshold ๅผไปฃ่กจใๅนๆ ผๅฎไฝใ่้็พๅๆฏใ
Note: In non-ATR% mode, the threshold is in price units, not percent.
โธป
่จ่่งฃ่ฎ / How to Read
โข ATR% > ไธ่ป๏ผๆณขๅ้กฏ่ๆดๅผต๏ผ่ถจๅขๅๅๆๅ ้ๅธธ่ฆ๏ผใ
ATR% above upper band: significant expansion; often trend ignition/acceleration.
โข ATR% < ไธ่ป๏ผๆณขๅๆ้กฏๅฃ็ธฎ๏ผๅธธ่ฆๆผ็ช็ ดๅ๏ผใ
ATR% below lower band: volatility squeeze; often precedes breakouts.
โข ATR% ็ฉฟ่ถ Threshold๏ผ1%๏ผ๏ผ้ๅฐๅบๅฎๆณขๅๆจๆบ๏ผๅฏไฝ็ญ็ฅ้้ๆ้ขจๆงๅๆฐดๅถบใ
ATR% crossing the 1% threshold: fixed volatility bar for filters/risk gates.
โธป
ๅ
งๅปบๅ่ญฆ / Built-in Alerts
โข Volatility Breakout (MTF)๏ผATR/ATR% ๅไธ็ฉฟ่ถไธ่ปใ
Triggers when ATR/ATR% crosses above the upper band.
โข Volatility Squeeze (MTF)๏ผATR/ATR% ๅไธ็ฉฟ่ถไธ่ปใ
Triggers when ATR/ATR% crosses below the lower band.
โธป
ไฝฟ็จๅปบ่ญฐ / Suggested Uses
โข ็ถๆฒๆฟพ็ถฒ๏ผๆผ 1โ5 ๅๅ้ธๆ 4H / D1 ไฝ็บ Source Timeframe๏ผๅ
ๅจ ATR% > 1% ไธไฝๆผไธญ็ทไปฅไธๆๅ
่จฑ่ถจๅข้ฒๅ ดใ
Intraday filter: on 1โ5m charts, set 4H/D1 as source TF; allow trend entries only when ATR% > 1% and above the midline.
โข ็ช็ ดๅๅตๆธฌ๏ผATR% ้ทๆ้่ฒผ่ฟไธ่ป โ ็ๆๅฏ่ฝ็ๆณขๅๆดๅผตใ
Pre-breakout scan: prolonged ATR% near lower band can foreshadow expansion.
โข ่ทจๅ็จฎๆฏ่ผ๏ผ็จ ATR% ็ตฑไธๆๆธใๅคๅฏใๅๅ็ๆณขๅๅปๅบฆใ
Cross-asset comparison: ATR% normalizes volatility across indices/FX/commodities.
โธป
ๅทฒ็ฅ้ๅถ / Notes
โข MTF ๅฐ้ฝ๏ผไฝฟ็จ request.security() ๅฐๆ ้ซ้ฑๆ่ณๆๅฐ็ถๅๅ่กจ๏ผๅจๆญทๅฒๅ่ฃ่ๅณๆ้็ๆฃๅฏ่ฝ็ฅๆๅทฎ็ฐใ
MTF alignment: request.security() maps higher-TF data; boundary bars may differ slightly between historical and realtime.
โข ็พๅๆฏๅๆฏ๏ผATR% ็ๅๆฏ็บๅไธ้ฑๆ็ close๏ผ่ฅ้ๆดๅนณๆปๅฏๆน ATR / SMA(close, N) ร 100ใ
Denominator: ATR% uses same-TF close; for smoother values consider ATR / SMA(close, N) ร 100.
โข ้ขจ้ช่ฒๆ๏ผๅ
ไพ็ ็ฉถ/ๆ่ฒ็จ้๏ผ้ๆ่ณๅปบ่ญฐ๏ผ่ซ่ช่กๆง็ฎก้ขจ้ชใ
Disclaimer: For research/education only. Not investment advice.
โธป
็ๆฌ่ๆดๆฐ / Version & Updates
โข v1.0๏ผATR/ATR% + BB๏ผMTF๏ผใ1% ็ฝ่ฒ้ป็ทใๅ
ฉ็ตๅ่ญฆใ
v1.0: ATR/ATR% + BB (MTF), 1% white dotted line, two alert conditions.
Pine Scriptยฎ indicator
`security()` revisited [PineCoders]NOTE
The non-repainting technique in this publication that relies on bar states is now deprecated, as we have identified inconsistencies that undermine its credibility as a universal solution. The outputs that use the technique are still available for reference in this publication. However, we do not endorse its usage. See this publication for more information about the current best practices for requesting HTF data and why they work.
โโ OVERVIEW
This script presents a new function to help coders use security() in both repainting and non-repainting modes. We revisit this often misunderstood and misused function, and explain its behavior in different contexts, in the hope of dispelling some of the coder lure surrounding it. The function is incredibly powerful, yet misused, it can become a dangerous WMD and an instrument of deception, for both coders and traders.
We will discuss:
โโข How to use our new `f_security()` function.
โโข The behavior of Pine code and security() on the three very different types of bars that make up any chart.
โโข Why what you see on a chart is a simulation, and should be taken with a grain of salt.
โโข Why we are presenting a new version of a function handling security() calls.
โโข Other topics of interest to coders using higher timeframe (HTF) data.
โโ WARNING
We have tried to deliver a function that is simple to use and will, in non-repainting mode, produce reliable results for both experienced and novice coders. If you are a novice coder, stick to our recommendations to avoid getting into trouble, and DO NOT change our `f_security()` function when using it. Use `false` as the function's last argument and refrain from using your script at smaller timeframes than the chart's. To call our function to fetch a non-repainting value of close from the 1D timeframe, use:
f_security(_sym, _res, _src, _rep) => security(_sym, _res, _src )
previousDayClose = f_security(syminfo.tickerid, "D", close, false)
If that's all you're interested in, you are done.
If you choose to ignore our recommendation and use the function in repainting mode by changing the `false` in there for `true`, we sincerely hope you read the rest of our ramblings before you do so, to understand the consequences of your choice.
Let's now have a look at what security() is showing you. There is a lot to cover, so buckle up! But before we dig in, one last thing.
What is a chart?
A chart is a graphic representation of events that occur in markets. As any representation, it is not reality, but rather a model of reality. As Scott Page eloquently states in The Model Thinker : "All models are wrong; many are useful". Having in mind that both chart bars and plots on our charts are imperfect and incomplete renderings of what actually occurred in realtime markets puts us coders in a place from where we can better understand the nature of, and the causes underlying the inevitable compromises necessary to build the data series our code uses, and print chart bars.
Traders or coders complaining that charts do not reflect reality act like someone who would complain that the word "dog" is not a real dog. Let's recognize that we are dealing with models here, and try to understand them the best we can. Sure, models can be improved; TradingView is constantly improving the quality of the information displayed on charts, but charts nevertheless remain mere translations. Plots of data fetched through security() being modelized renderings of what occurs at higher timeframes, coders will build more useful and reliable tools for both themselves and traders if they endeavor to perfect their understanding of the abstractions they are working with. We hope this publication helps you in this pursuit.
โโ FEATURES
This script's "Inputs" tab has four settings:
โโข Repaint : Determines whether the functions will use their repainting or non-repainting mode.
โโNote that the setting will not affect the behavior of the yellow plot, as it always repaints.
โโข Source : The source fetched by the security() calls.
โโข Timeframe : The timeframe used for the security() calls. If it is lower than the chart's timeframe, a warning appears.
โโข Show timeframe reminder : Displays a reminder of the timeframe after the last bar.
โโ THE CHART
The chart shows two different pieces of information and we want to discuss other topics in this section, so we will be covering:
โA โ The type of chart bars we are looking at, indicated by the colored band at the top.
โB โ The plots resulting of calling security() with the close price in different ways.
โC โ Points of interest on the chart.
A โ Chart bars
The colored band at the top shows the three types of bars that any chart on a live market will print. It is critical for coders to understand the important distinctions between each type of bar:
โ1 โ Gray : Historical bars, which are bars that were already closed when the script was run on them.
โ2 โ Red : Elapsed realtime bars, i.e., realtime bars that have run their course and closed.
โโโThe state of script calculations showing on those bars is that of the last time they were made, when the realtime bar closed.
โ3 โ Green : The realtime bar. Only the rightmost bar on the chart can be the realtime bar at any given time, and only when the chart's market is active.
Refer to the Pine User Manual's Execution model page for a more detailed explanation of these types of bars.
B โ Plots
The chart shows the result of letting our 5sec chart run for a few minutes with the following settings: "Repaint" = "On" (the default is "Off"), "Source" = `close` and "Timeframe" = 1min. The five lines plotted are the following. They have progressively thinner widths:
โ1 โ Yellow : A normal, repainting security() call.
โ2 โ Silver : Our recommended security() function.
โ3 โ Fuchsia : Our recommended way of achieving the same result as our security() function, for cases when the source used is a function returning a tuple.
โ4 โ White : The method we previously recommended in our MTF Selection Framework , which uses two distinct security() calls.
โ5 โ Black : A lame attempt at fooling traders that MUST be avoided.
All lines except the first one in yellow will vary depending on the "Repaint" setting in the script's inputs. The first plot does not change because, contrary to all other plots, it contains no conditional code to adapt to repainting/no-repainting modes; it is a simple security() call showing its default behavior.
C โ Points of interest on the chart
Historical bars do not show actual repainting behavior
To appreciate what a repainting security() โcall will plot in realtime, one must look at the realtime bar and at elapsed realtime bars, the bars where the top line is green or red on the chart at the top of this page. There you can see how the plots go up and down, following the close value of each successive chart bar making up a single bar of the higher timeframe. You would see the same behavior in "Replay" mode. In the realtime bar, the movement of repainting plots will vary with the source you are fetching: open will not move after a new timeframe opens, low and high will change when a new low or high are found, close will follow the last feed update. If you are fetching a value calculated by a function, it may also change on each update.
Now notice how different the plots are on historical bars. There, the plot shows the close of the previously completed timeframe for the whole duration of the current timeframe, until on its last bar the price updates to the current timeframe's close when it is confirmed (if the timeframe's last bar is missing, the plot will only update on the next timeframe's first bar). That last bar is the only one showing where the plot would end if that timeframe's bars had elapsed in realtime. If one doesn't understand this, one cannot properly visualize how his script will calculate in realtime when using repainting. Additionally, as published scripts typically show charts where the script has only run on historical bars, they are, in fact, misleading traders who will naturally assume the script will behave the same way on realtime bars.
Non-repainting plots are more accurate on historical bars
Now consider this chart, where we are using the same settings as on the chart used to publish this script, except that we have turned "Repainting" off this time:
The yellow line here is our reference, repainting line, so although repainting is turned off, it is still repainting, as expected. Because repainting is now off, however, plots on historical bars show the previous timeframe's close until the first bar of a new timeframe, at which point the plot updates. This correctly reflects the behavior of the script in the realtime bar, where because we are offsetting the series by one, we are always showing the previously calculatedโand thus confirmedโhigher timeframe value. This means that in realtime, we will only get the previous timeframe's values one bar after the timeframe's last bar has elapsed, at the open of the first bar of a new timeframe. Historical and elapsed realtime bars will not actually show this nuance because they reflect the state of calculations made on their close , but we can see the plot update on that bar nonetheless.
โบ This more accurate representation on historical bars of what will happen in the realtime bar is one of the two key reasons why using non-repainting data is preferable.
โโโThe other is that in realtime, your script will be using more reliable data and behave more consistently.
Misleading plots
Valiant attempts by coders to show non-repainting, higher timeframe data updating earlier than on our chart are futile. If updates occur one bar earlier because coders use the repainting version of the function, then so be it, but they must then also accept that their historical bars are not displaying information that is as accurate. Not informing script users of this is to mislead them. Coders should also be aware that if they choose to use repainting data in realtime, they are sacrificing reliability to speed and may be running a strategy that behaves very differently from the one they backtested, thus invalidating their tests.
When, however, coders make what are supposed to be non-repainting plots plot artificially early on historical bars, as in examples "c4" and "c5" of our script, they would want us to believe they have achieved the miracle of time travel. Our understanding of the current state of science dictates that for now, this is impossible. Using such techniques in scripts is plainly misleading, and public scripts using them will be moderated. We are coding trading tools hereโnot video games. Elementary ethics prescribe that we should not mislead traders, even if it means not being able to show sexy plots. As the great Feynman said: You should not fool the layman when you're talking as a scientist.
You can readily appreciate the fantasy plot of "c4", the thinnest line in black, by comparing its supposedly non-repainting behavior between historical bars and realtime bars. After updatingโby miracleโas early as the wide yellow line that is repainting, it suddenly moves in a more realistic place when the script is running in realtime, in synch with our non-repainting lines. The "c5" version does not plot on the chart, but it displays in the Data Window. It is even worse than "c4" in that it also updates magically early on historical bars, but goes on to evaluate like the repainting yellow line in realtime, except one bar late.
Data Window
The Data Window shows the values of the chart's plots, then the values of both the inside and outside offsets used in our calculations, so you can see them change bar by bar. Notice their differences between historical and elapsed realtime bars, and the realtime bar itself. If you do not know about the Data Window, have a look at this essential tool for Pine coders in the Pine User Manual's page on Debugging . The conditional expressions used to calculate the offsets may seem tortuous but their objective is quite simple. When repainting is on, we use this form, so with no offset on all bars:
security(ticker, i_timeframe, i_source )
// which is equivalent to:
security(ticker, i_timeframe, i_source)
When repainting is off, we use two different and inverted offsets on historical bars and the realtime bar:
// Historical bars:
security(ticker, i_timeframe, i_source )
// Realtime bar (and thus, elapsed realtime bars):
security(ticker, i_timeframe, i_source )
The offsets in the first line show how we prevent repainting on historical bars without the need for the `lookahead` parameter. We use the value of the function call on the chart's previous bar. Since values between the repainting and non-repainting versions only differ on the timeframe's last bar, we can use the previous value so that the update only occurs on the timeframe's first bar, as it will in realtime when not repainting.
In the realtime bar, we use the second call, where the offsets are inverted. This is because if we used the first call in realtime, we would be fetching the value of the repainting function on the previous bar, so the close of the last bar. What we want, instead, is the data from the previous, higher timeframe bar , which has elapsed and is confirmed, and thus will not change throughout realtime bars, except on the first constituent chart bar belonging to a new higher timeframe.
After the offsets, the Data Window shows values for the `barstate.*` variables we use in our calculations.
โโ NOTES
Why are we revisiting security() โ?
For four reasons:
โ1 โ We were seeing coders misuse our `f_secureSecurity()` function presented in How to avoid repainting when using security() .
โโโSome novice coders were modifying the offset used with the history-referencing operator in the function, making it zero instead of one,
โโโwhich to our horror, caused look-ahead bias when used with `lookahead = barmerge.lookahead_on`.
โโโWe wanted to present a safer function which avoids introducing the dreaded "lookahead" in the scripts of unsuspecting coders.
โ2 โ The popularity of security() in screener-type scripts where coders need to use the full 40 calls allowed per script made us want to propose
โโโa solid method of allowing coders to offer a repainting/no-repainting choice to their script users with only one security() call.
โ3 โ We wanted to explain why some alternatives we see circulating are inadequate and produce misleading behavior.
โ4 โ Our previous publication on security() focused on how to avoid repainting, yet many other considerations worthy of attention are not related to repainting.
Handling tuples
When sending function calls that return tuples with security() , our `f_security()` function will not work because Pine does not allow us to use the history-referencing operator with tuple return values. The solution is to integrate the inside offset to your function's arguments, use it to offset the results the function is returning, and then add the outside offset in a reassignment of the tuple variables, after security() returns its values to the script, as we do in our "c2" example.
Does it repaint?
We're pretty sure Wilder was not asked very often if RSI repainted. Why? Because it wasn't in fashionโand largely unnecessaryโto ask that sort of question in the 80's. Many traders back then used daily charts only, and indicator values were calculated at the day's close, so everybody knew what they were getting. Additionally, indicator values were calculated by generally reputable outfits or traders themselves, so data was pretty reliable. Today, almost anybody can write a simple indicator, and the programming languages used to write them are complex enough for some coders lacking the caution, know-how or ethics of the best professional coders, to get in over their heads and produce code that does not work the way they think it does.
As we hope to have clearly demonstrated, traders do have legitimate cause to ask if MTF scripts repaint or not when authors do not specify it in their script's description.
โบ We recommend that authors always use our `f_security()` with `false` as the last argument to avoid repainting when fetching data dependent on OHLCV information. This is the only way to obtain reliable HTF data. If you want to offer users a choice, make non-repainting mode the default, so that if users choose repainting, it will be their responsibility. Non-repainting security() calls are also the only way for scripts to show historical behavior that matches the script's realtime behavior, so you are not misleading traders. Additionally, non-repainting HTF data is the only way that non-repainting alerts can be configured on MTF scripts, as users of MTF scripts cannot prevent their alerts from repainting by simply configuring them to trigger on the bar's close.
Data feeds
A chart at one timeframe is made up of multiple feeds that mesh seamlessly to form one chart. Historical bars can use one feed, and the realtime bar another, which brokers/exchanges can sometimes update retroactively so that elapsed realtime bars will reappear with very slight modifications when the browser's tab is refreshed. Intraday and daily chart prices also very often originate from different feeds supplied by brokers/exchanges. That is why security() calls at higher timeframes may be using a completely different feed than the chart, and explains why the daily high value, for example, can vary between timeframes. Volume information can also vary considerably between intraday and daily feeds in markets like stocks, because more volume information becomes available at the end of day. It is thus expected behaviorโand not a bugโto see data variations between timeframes.
Another point to keep in mind concerning feeds it that when you are using a repainting security() plot in realtime, you will sometimes see discrepancies between its plot and the realtime bars. An artefact revealing these inconsistencies can be seen when security() plots sometimes skip a realtime chart bar during periods of high market activity. This occurs because of races between the chart and the security() feeds, which are being monitored by independent, concurrent processes. A blue arrow on the chart indicates such an occurrence. This is another cause of repainting, where realtime bar-building logic can produce different outcomes on one closing price. It is also another argument supporting our recommendation to use non-repainting data.
Alternatives
There is an alternative to using security() in some conditions. If all you need are OHLC prices of a higher timeframe, you can use a technique like the one Duyck demonstrates in his security free MTF example - JD script. It has the great advantage of displaying actual repainting values on historical bars, which mimic the code's behavior in the realtime barโor at least on elapsed realtime bars, contrary to a repainting security() plot. It has the disadvantage of using the current chart's TF data feed prices, whereas higher timeframe data feeds may contain different and more reliable prices when they are compiled at the end of the day. In its current state, it also does not allow for a repainting/no-repainting choice.
When `lookahead` is useful
When retrieving non-price data, or in special cases, for experiments, it can be useful to use `lookahead`. One example is our Backtesting on Non-Standard Charts: Caution! script where we are fetching prices of standard chart bars from non-standard charts.
Warning users
Normal use of security() dictates that it only be used at timeframes equal to or higher than the chart's. To prevent users from inadvertently using your script in contexts where it will not produce expected behavior, it is good practice to warn them when their chart is on a higher timeframe than the one in the script's "Timeframe" field. Our `f_tfReminderAndErrorCheck()` function in this script does that. It can also print a reminder of the higher timeframe. It uses one security() call.
Intrabar timeframes
security() is not supported by TradingView when used with timeframes lower than the chart's. While it is still possible to use security() at intrabar timeframes, it then behaves differently. If no care is taken to send a function specifically written to handle the successive intrabars, security() will return the value of the last intrabar in the chart's timeframe, so the last 1H bar in the current 1D bar, if called at "60" from a "D" chart timeframe. If you are an advanced coder, see our FAQ entry on the techniques involved in processing intrabar timeframes. Using intrabar timeframes comes with important limitations, which you must understand and explain to traders if you choose to make scripts using the technique available to others. Special care should also be taken to thoroughly test this type of script. Novice coders should refrain from getting involved in this.
โโ TERMINOLOGY
Timeframe
Timeframe , interval and resolution are all being used to name the concept of timeframe. We have, in the past, used "timeframe" and "resolution" more or less interchangeably. Recently, members from the Pine and PineCoders team have decided to settle on "timeframe", so from hereon we will be sticking to that term.
Multi-timeframe (MTF)
Some coders use "multi-timeframe" or "MTF" to name what are in fact "multi-period" calculations, as when they use MAs of progressively longer periods. We consider that a misleading use of "multi-timeframe", which should be reserved for code using calculations actually made from another timeframe's context and using security() , safe for scripts like Duyck's one mentioned earlier, or TradingView's RelativeโโVolumeโโatโโTime , which use a user-selected timeframe as an anchor to reset calculations. Calculations made at the chart's timeframe by varying the period of MAs or other rolling window calculations should be called "multi-period", and "MTF-anchored" could be used for scripts that reset calculations on timeframe boundaries.
Colophon
Our script was written using the PineCoders Coding Conventions for Pine .
The description was formatted using the techniques explained in the How We Write and Format Script Descriptions PineCoders publication.
Snippets were lifted from our MTF Selection Framework , then massaged to create the `f_tfReminderAndErrorCheck()` function.
โโ THANKS
Thanks to apozdnyakov for his help with the innards of security() .
Thanks to bmistiaen for proofreading our description.
Look first. Then leap.
WoAlgo Premium v3.0
WoAlgo Premium v3.0 - Smart Money Analysis
Overview
** WoAlgo Premium v3.0 ** is an advanced technical analysis indicator designed for educational purposes. This tool combines Smart Money Concepts with multi-factor confluence analysis to help traders identify potential market opportunities across multiple timeframes.
The indicator integrates market structure analysis, order flow concepts, and technical momentum indicators into a comprehensive dashboard system. It is designed to assist traders in understanding institutional trading patterns and market dynamics through visual analysis tools.
### What It Does
This indicator provides:
**1. Smart Money Concepts Analysis**
- Market structure identification (Break of Structure and Change of Character patterns)
- Order block detection with volume confirmation
- Fair value gap recognition
- Liquidity zone mapping (equal highs and lows)
- Premium and discount zone calculations
**2. Multi-Factor Confluence Scoring**
The indicator calculates a proprietary confluence score (0-100) based on five key components:
- Price action analysis (30% weight)
- Volume confirmation (20% weight)
- Momentum indicators (25% weight)
- Trend strength measurement (15% weight)
- Money flow analysis (10% weight)
**3. Multi-Timeframe Analysis**
- Scans 5 different timeframes (5M, 15M, 1H, 4H, Daily)
- Calculates alignment percentage across timeframes
- Displays trend and structure status for each period
**4. Visual Dashboard System**
- Comprehensive main dashboard with 13 metrics
- Real-time screener table with 10 data columns
- Multi-timeframe scanner
- Performance tracking panel
### How It Works
**Market Structure Detection**
The indicator identifies key structural changes in price action:
- **BOS (Break of Structure)**: Indicates trend continuation when price breaks previous swing points
- **CHoCH (Change of Character)**: Signals potential trend reversal when market structure shifts
**Order Block Identification**
Order blocks are detected when:
- Significant volume appears at swing points
- Price shows strong directional movement from these levels
- Enhanced detection with extreme volume confirmation (OB++ markers)
**Fair Value Gap Recognition**
Gaps between candles are identified when:
- Price leaves inefficiencies in the market
- Three consecutive candles create a gap pattern
- Gap size exceeds minimum threshold based on ATR
**Confluence Calculation**
The system evaluates multiple technical factors:
1. **Price Position**: Relative to moving averages (EMA 20, 50, 200)
2. **Volume Analysis**: Standard deviation-based volume spikes
3. **Momentum**: RSI, MACD, Stochastic indicators
4. **Trend Strength**: ADX measurements
5. **Money Flow**: MFI indicator readings
Each factor contributes weighted points to create an overall confluence score that helps assess signal strength.
### Signal Types
**Confirmation Signals (โฒ / โผ)**
Generated when:
- EMA crossovers occur (20/50 cross)
- Volume confirmation is present
- RSI is in appropriate zone
- Confluence score exceeds 50%
**Strong Signals (โฒ+ / โผ+)**
Higher-confidence signals requiring:
- Confluence score above 70%
- Extreme volume confirmation
- Alignment with 200 EMA trend
- MACD confirmation
- Bullish or bearish market structure
**Contrarian Signals (โก)**
Reversal indicators appearing when:
- RSI reaches extreme levels (<30 or >70)
- Stochastic shows oversold/overbought conditions
- Price touches Bollinger Band extremes
- Potential divergence patterns emerge
**Reversal Zones**
Visual boxes highlighting areas where:
- Market structure conflicts with momentum
- High probability of directional change
- Key support/resistance levels interact
**Smart Trail**
Dynamic stop-loss indicator that:
- Adjusts based on ATR (Average True Range)
- Follows trend direction
- Updates automatically as price moves
- Provides risk management reference points
### Dashboard Components
**Main Dashboard (13 Metrics)**
1. **Confluence Score**: Current bull/bear percentage (0-100)
2. **Market Regime**: Trend classification (Strong Up/Down, Range, Squeeze)
3. **Signal Status**: Active buy/sell signal indication
4. **Structure State**: Current market structure (Bullish/Bearish/Neutral)
5. **Trend Strength**: ADX-based measurement
6. **RSI Level**: Momentum indicator with overbought/oversold zones
7. **MACD Direction**: Trend momentum confirmation
8. **Money Flow Index**: Smart money sentiment
9. **Volume Status**: Current volume relative to average
10. **Volatility Rating**: ATR percentage measurement
11. **ATR Value**: Average true range for position sizing
12. **MTF Alignment**: Multi-timeframe agreement percentage
**Screener Table (10 Columns)**
- Current symbol and timeframe
- Real-time price and percentage change
- Quality rating (star system)
- Active signal type
- Smart trail status
- Market structure state
- MACD direction
- Trend strength percentage
- Bollinger Band squeeze detection
**MTF Scanner (5 Timeframes)**
Displays for each timeframe:
- Trend direction indicator
- Market structure classification
- Visual confirmation with color coding
**Performance Metrics**
- Win rate percentage (simplified calculation)
- Total signals generated
- Current confluence score
- MTF alignment status
- Volatility level
### Settings and Customization
**Preset Styles**
Choose from predefined configurations:
- **Conservative**: Fewer, higher-quality signals
- **Moderate**: Balanced approach (recommended)
- **Aggressive**: More frequent signals
- **Scalper**: Short-term focused
- **Swing**: Longer-term oriented
- **Custom**: Full manual control
**Smart Money Concepts Controls**
- Toggle each feature independently
- Adjust swing length (3-50 periods)
- Enable/disable internal structure
- Control order block display
- Manage breaker block visibility
- Show/hide fair value gaps
- Display liquidity zones
- Premium/discount zone visualization
**Signal Configuration**
- Enable/disable confirmation signals
- Toggle strong signal markers
- Control contrarian signal display
- Show/hide reversal zones
- Smart trail activation
- Sensitivity adjustment (5-50)
**Visual Customization**
- Moving average display options
- MA period adjustments (Fast: 20, Slow: 50, Trend: 200)
- Support/resistance line toggle
- Dynamic S/R lookback period
- Candle coloring based on trend
- Color scheme customization
- Dashboard size options (Small/Normal/Large)
- Position placement (4 corners)
### How to Use
**Step 1: Initial Setup**
1. Add indicator to chart
2. Select appropriate preset or use Custom
3. Adjust timeframe to match trading style
4. Configure dashboard visibility preferences
**Step 2: Analysis Workflow**
1. Check MTF Scanner for timeframe alignment
2. Review Main Dashboard confluence score
3. Observe Market Regime classification
4. Identify active signals on chart
5. Confirm with Smart Money Concepts (order blocks, FVG, structure)
**Step 3: Trade Consideration**
Strong signals (โฒ+ / โผ+) require:
- Confluence score >70%
- MTF alignment >60%
- Confirmation from multiple dashboard metrics
- Support from Smart Money Concepts
- Appropriate volume levels
**Step 4: Risk Management**
- Use Smart Trail as dynamic stop-loss reference
- Consider ATR for position sizing
- Monitor volatility rating
- Respect support/resistance levels
- Combine with personal risk parameters
### Best Practices
**For Scalping (1M-5M timeframes)**
- Use Scalper preset
- Reduce swing length to 5-7
- Focus on strong signals only
- Monitor MTF alignment closely
- Quick entries near order blocks
**For Intraday Trading (15M-1H timeframes)**
- Use Moderate preset (recommended)
- Default swing length (10)
- Combine confirmation and strong signals
- Check MTF scanner before entry
- Use fair value gaps for entries
**For Swing Trading (4H-D timeframes)**
- Use Swing preset
- Increase swing length to 15-20
- Focus on strong signals
- Require high MTF alignment
- Patient approach with major structure levels
### Technical Specifications
**Indicators Used**
- Exponential Moving Averages (20, 50, 200)
- Hull Moving Average
- Relative Strength Index (14)
- MACD (12, 26, 9)
- Money Flow Index (14)
- Stochastic Oscillator (14, 3)
- ADX / DMI (14)
- Bollinger Bands (20, 2)
- ATR (14)
- Volume Analysis (SMA 20 with standard deviation)
**Calculation Methods**
- Swing detection using pivot high/low functions
- Volume confirmation via statistical analysis
- Multi-factor scoring with weighted components
- Dynamic support/resistance using highest/lowest functions
- Real-time MTF data via security() function
### Limitations and Considerations
**Important Notes**
1. This indicator is designed for educational and analytical purposes only
2. Historical performance does not guarantee future results
3. Signals should be confirmed with additional analysis
4. Market conditions vary and affect indicator performance
5. Not all signals will be profitable
6. Risk management is essential for all trading
**Known Limitations**
- Confluence scoring is algorithmic and not predictive
- MTF analysis requires sufficient historical data
- Effectiveness varies across different market conditions
- Sideways markets may produce conflicting signals
- High volatility can affect signal reliability
- Backtesting results shown are simplified calculations
**Not Suitable For**
- Automated trading without human oversight
- Sole basis for trading decisions
- Guaranteed profit expectations
- Inexperienced traders without proper education
- Trading without risk management plans
### Market Applicability
**Effective On**
- Trending markets (any direction)
- Clear structure formation periods
- Liquid instruments with consistent volume
- Multiple asset classes (forex, stocks, crypto, commodities)
- Various timeframes with appropriate settings
**Less Effective During**
- Extended ranging/choppy conditions
- Extremely low volume periods
- Major news events causing gaps
- Early market open with high spread
- Illiquid instruments with erratic price action
### Risk Disclaimer
**โ ๏ธ IMPORTANT NOTICE**
This indicator is provided for **educational and informational purposes only**. It does not constitute financial advice, investment recommendations, or trading signals.
**Key Risk Factors:**
- Trading financial instruments involves substantial risk of loss
- Past performance does not indicate future results
- No indicator can predict market movements with certainty
- Users should conduct independent research and analysis
- Professional financial advice should be sought when appropriate
- Risk management and position sizing are critical to successful trading
- Users are solely responsible for their trading decisions
**Responsible Usage:**
- Combine with comprehensive market analysis
- Use appropriate stop-loss orders
- Never risk more than you can afford to lose
- Maintain realistic expectations
- Continue education on technical analysis principles
- Test thoroughly on demo accounts before live trading
- Understand all indicator features before using
### Educational Resources
**Understanding Smart Money Concepts**
Smart Money Concepts analyze how institutional traders and large market participants operate. Key principles include:
- Institutional order flow patterns
- Market structure changes
- Liquidity manipulation
- Supply and demand imbalances
- Order block formations
**Multi-Timeframe Analysis Theory**
Analyzing multiple timeframes helps:
- Identify overall market direction
- Improve entry timing
- Confirm trend strength
- Recognize consolidation periods
- Reduce conflicting signals
**Confluence Trading Approach**
Using multiple confirming factors:
- Increases signal reliability
- Reduces false signals
- Provides conviction for trades
- Helps with position sizing
- Improves risk-reward ratios
### Version History
**v3.0 (Current)**
- Multi-factor confluence scoring system
- Complete Smart Money Concepts implementation
- Real-time multi-timeframe analysis
- Four professional dashboard panels
- Enhanced order block detection
- Breaker block identification
- Premium/discount zone calculations
- Smart trail stop-loss system
- Customizable preset configurations
- Performance tracking metrics
**Development Philosophy**
This indicator was developed with focus on:
- Educational value for traders
- Transparent methodology
- Comprehensive feature set
- User-friendly interface
- Flexible customization options
### Technical Support
**For Questions About:**
- Indicator functionality
- Parameter optimization
- Signal interpretation
- Dashboard metrics
- Best practice recommendations
Please use TradingView's comment section below. The developer monitors comments and provides assistance to users learning to use the indicator effectively.
### Acknowledgments
This indicator implements concepts from:
- Smart Money Concepts trading methodology
- Multi-timeframe analysis techniques
- Technical indicator theory
- Market structure analysis principles
- Institutional order flow concepts
All implementations are original code and calculations based on established technical analysis principles.
---
## ADDITIONAL INFORMATION SECTION
**Category**: Indicators
**Type**: Market Structure / Multi-Timeframe Analysis
**Complexity**: Intermediate to Advanced
**Open Source**: Code visible for transparency and education
**Pine Script Version**: v6
**Chart Overlay**: Yes
**Maximum Objects**: 500 boxes, 500 lines, 500 labels
Pine Scriptยฎ indicator
Luxy Super-Duper SuperTrend Predictor Engine and Buy/Sell signalA professional trend-following grading system that analyzes historical trend
patterns to provide statistical duration estimates using advanced similarity
matching and k-nearest neighbors analysis. Combines adaptive Supertrend with
intelligent duration statistics, multi-timeframe confluence, volume confirmation,
and quality scoring to identify high-probability setups with data-driven
target ranges across all timeframes.
Note: All duration estimates are statistical calculations based on historical data, not guarantees of future performance.
WHAT MAKES THIS DIFFERENT
Unlike traditional SuperTrend indicators that only tell you trend direction, this system answers the critical question: "What is the typical duration for trends like this?"
The Statistical Analysis Engine:
โข Analyzes your chart's last 15+ completed SuperTrend trends (bullish and bearish separately)
โข Uses k-nearest neighbors similarity matching to find historically similar setups
โข Calculates statistical duration estimates based on current market conditions
โข Learns from estimation errors and adapts over time (Advanced mode)
โข Displays visual duration analysis box showing median, average, and range estimates
โข Tracks Statistical accuracy with backtest statistics
Complete Trading System:
โข Statistical trend duration analysis with three intelligence levels
โข Adaptive Supertrend with dynamic ATR-based bands
โข Multi-timeframe confluence analysis (6 timeframes: 5M to 1W)
โข Volume confirmation with spike detection and momentum tracking
โข Quality scoring system (0-70 points) rating each setup
โข One-click preset optimization for all trading styles
โข Anti-repaint guarantee on all signals and duration estimates
METHODOLOGY CREDITS
This indicator's approach is inspired by proven trading methodologies from respected market educators:
โข Mark Minervini - Volatility Contraction Pattern (VCP) and pullback entry techniques
โข William O'Neil - Volume confirmation principles and institutional buying patterns (CANSLIM methodology)
โข Dan Zanger - Volatility expansion entries and momentum breakout strategies
Important: These are educational references only. This indicator does not guarantee any specific trading results. Always conduct your own analysis and risk management.
KEY FEATURES
1. TREND DURATION ANALYSIS SYSTEM - The Core Innovation
The statistical analysis engine is what sets this indicator apart from standard SuperTrend systems. It doesn't just identify trend changes - it provides statistical analysis of potential duration.
How It Works:
Step 1: Historical Tracking
โข Automatically records every completed SuperTrend trend (duration in bars)
โข Maintains separate databases for bullish trends and bearish trends
โข Stores up to 15 most recent trends of each type
โข Captures market conditions at each trend flip: volume ratio, ATR ratio, quality score, price distance from SuperTrend, proximity to support/resistance
Step 2: Similarity Matching (k-Nearest Neighbors)
โข When new trend begins, system compares current conditions to ALL historical flips
โข Calculates similarity score based on:
- Volume similarity (30% weight) - Is volume behaving similarly?
- Volatility similarity (30% weight) - Is ATR/volatility similar?
- Quality similarity (20% weight) - Is setup strength comparable?
- Distance similarity (10% weight) - Is price distance from ST similar?
- Support/Resistance proximity (10% weight) - Similar structural context?
โข Selects the 15 MOST SIMILAR historical trends (not just all trends)
โข This is like asking: "When conditions looked like this before, how long did trends last?"
Step 3: Statistical Analysis
โข Calculates median duration (most common outcome)
โข Calculates average duration (mean of similar trends)
โข Determines realistic range (min to max of similar trends)
โข Applies exponential weighting (recent trends weighted more heavily)
โข Outputs confidence-weighted statistical estimate
Step 4: Advanced Intelligence (Advanced Mode Only)
The Advanced mode applies five sophisticated multipliers to refine estimates:
A) Market Structure Multiplier (ยฑ30%):
โข Detects nearby support/resistance levels using pivot detection
โข If flip occurs NEAR a key level: Estimate adjusted -30% (expect bounce/rejection)
โข If flip occurs in open space: Estimate adjusted +30% (clear path for continuation)
โข Uses configurable lookback period and ATR-based proximity threshold
B) Asset Type Multiplier (ยฑ40%):
โข Adjusts duration estimates based on asset volatility characteristics
โข Small Cap / Biotech: +40% (explosive, extended moves)
โข Tech Growth: +20% (momentum-driven, longer trends)
โข Blue Chip / Large Cap: 0% (baseline, steady trends)
โข Dividend / Value: -20% (slower, grinding trends)
โข Cyclical: Variable based on macro regime
โข Crypto / High Volatility: +30% (parabolic potential)
C) Flip Strength Multiplier (ยฑ20%):
โข Analyzes the QUALITY of the trend flip itself
โข Strong flip (high volume + expanding ATR + quality score 60+): +20%
โข Weak flip (low volume + contracting ATR + quality score under 40): -20%
โข Logic: Historical data shows that powerful flips tend to be followed by longer trends
D) Error Learning Multiplier (ยฑ15%):
โข Tracks Statistical accuracy over last 10 completed trends
โข Calculates error ratio: (estimated duration / Actual Duration)
โข If system consistently over-estimates: Apply -15% correction
โข If system consistently under-estimates: Apply +15% correction
โข Learns and adapts to current market regime
E) Regime Detection Multiplier (ยฑ20%):
โข Analyzes last 3 trends of SAME TYPE (bull-to-bull or bear-to-bear)
โข Compares recent trend durations to historical average
โข If recent trends 20%+ longer than average: +20% adjustment (trending regime detected)
โข If recent trends 20%+ shorter than average: -20% adjustment (choppy regime detected)
โข Detects whether market is in trending or mean-reversion mode
Three analysis modes:
SIMPLE MODE - Basic Statistics
โข Uses raw median of similar trends only
โข No multipliers, no adjustments
โข Best for: Beginners, clean trending markets
โข Fastest calculations, minimal complexity
STANDARD MODE - Full Statistical Analysis
โข Similarity matching with k-nearest neighbors
โข Exponential weighting of recent trends
โข Median, average, and range calculations
โข Best for: Most traders, general market conditions
โข Balance of accuracy and simplicity
ADVANCED MODE - Statistics + Intelligence
โข Everything in Standard mode PLUS
โข All 5 advanced multipliers (structure, asset type, flip strength, learning, regime)
โข Highest Statistical accuracy in testing
โข Best for: Experienced traders, volatile/complex markets
โข Maximum intelligence, most adaptive
Visual Duration Analysis Box:
When a new trend begins (SuperTrend flip), a box appears on your chart showing:
โข Analysis Mode (Simple / Standard / Advanced)
โข Number of historical trends analyzed
โข Median expected duration (most likely outcome)
โข Average expected duration (mean of similar trends)
โข Range (minimum to maximum from similar trends)
โข Advanced multipliers breakdown (Advanced mode only)
โข Backtest accuracy statistics (if available)
The box extends from the flip bar to the estimated endpoint based on historical data, giving you a visual target for trend duration. Box updates in real-time as trend progresses.
Backtest & Accuracy Tracking:
โข System backtests its own duration estimates using historical data
โข Shows accuracy metrics: how well duration estimates matched actual durations
โข Tracks last 10 completed duration estimates separately
โข Displays statistics in dashboard and duration analysis boxes
โข Helps you understand statistical reliability on your specific symbol/timeframe
Anti-Repaint Guarantee:
โข duration analysis boxes only appear AFTER bar close (barstate.isconfirmed)
โข Historical duration estimates never disappear or change
โข What you see in history is exactly what you would have seen real-time
โข No future data leakage, no lookahead bias
2. INTELLIGENT PRESET CONFIGURATIONS - One-Click Optimization
Unlike indicators that require tedious parameter tweaking, this system includes professionally optimized presets for every trading style. Select your approach from the dropdown and ALL parameters auto-configure.
"AUTO (DETECT FROM TF)" - RECOMMENDED
The smartest option: automatically selects optimal settings based on your chart timeframe.
โข 1m-5m charts โ Scalping preset (ATR: 7, Mult: 2.0)
โข 15m-1h charts โ Day Trading preset (ATR: 10, Mult: 2.5)
โข 2h-4h-D charts โ Swing Trading preset (ATR: 14, Mult: 3.0)
โข W-M charts โ Position Trading preset (ATR: 21, Mult: 4.0)
Benefits:
โข Zero configuration - works immediately
โข Always matched to your timeframe
โข Switch timeframe = automatic adjustment
โข Perfect for traders who use multiple timeframes
"SCALPING (1-5M)" - Ultra-Fast Signals
Optimized for: 1-5 minute charts, high-frequency trading, quick profits
Target holding period: Minutes to 1-2 hours maximum
Best markets: High-volume stocks, major crypto pairs, active futures
Parameter Configuration:
โข Supertrend: ATR 7, Multiplier 2.0 (very sensitive)
โข Volume: MA 10, High 1.8x, Spike 3.0x (catches quick surges)
โข Volume Momentum: AUTO-DISABLED (too restrictive for fast scalping)
โข Quality minimum: 40 points (accepts more setups)
โข Duration Analysis: Uses last 15 trends with heavy recent weighting
Trading Logic:
Speed over precision. Short ATR period and low multiplier create highly responsive SuperTrend. Volume momentum filter disabled to avoid missing fast moves. Quality threshold relaxed to catch more opportunities in rapid market conditions.
Signals per session: 5-15 typically
Hold time: Minutes to couple hours
Best for: Active traders with fast execution
"DAY TRADING (15M-1H)" - Balanced Approach
Optimized for: 15-minute to 1-hour charts, intraday moves, session-based trading
Target holding period: 30 minutes to 8 hours (within trading day)
Best markets: Large-cap stocks, major indices, established crypto
Parameter Configuration:
โข Supertrend: ATR 10, Multiplier 2.5 (balanced)
โข Volume: MA 20, High 1.5x, Spike 2.5x (standard detection)
โข Volume Momentum: 5/20 periods (confirms intraday strength)
โข Quality minimum: 50 points (good setups preferred)
โข Duration Analysis: Balanced weighting of recent vs historical
Trading Logic:
The most balanced configuration. ATR 10 with multiplier 2.5 provides steady trend following that avoids noise while catching meaningful moves. Volume momentum confirms institutional participation without being overly restrictive.
Signals per session: 2-5 typically
Hold time: 30 minutes to full day
Best for: Part-time and full-time active traders
"SWING TRADING (4H-D)" - Trend Stability
Optimized for: 4-hour to Daily charts, multi-day holds, trend continuation
Target holding period: 2-15 days typically
Best markets: Growth stocks, sector ETFs, trending crypto, commodity futures
Parameter Configuration:
โข Supertrend: ATR 14, Multiplier 3.0 (stable)
โข Volume: MA 30, High 1.3x, Spike 2.2x (accumulation focus)
โข Volume Momentum: 10/30 periods (trend stability)
โข Quality minimum: 60 points (high-quality setups only)
โข Duration Analysis: Favors consistent historical patterns
Trading Logic:
Designed for substantial trend moves while filtering short-term noise. Higher ATR period and multiplier create stable SuperTrend that won't flip on minor corrections. Stricter quality requirements ensure only strongest setups generate signals.
Signals per week: 2-5 typically
Hold time: Days to couple weeks
Best for: Part-time traders, swing style
"POSITION TRADING (D-W)" - Long-Term Trends
Optimized for: Daily to Weekly charts, major trend changes, portfolio allocation
Target holding period: Weeks to months
Best markets: Blue-chip stocks, major indices, established cryptocurrencies
Parameter Configuration:
โข Supertrend: ATR 21, Multiplier 4.0 (very stable)
โข Volume: MA 50, High 1.2x, Spike 2.0x (long-term accumulation)
โข Volume Momentum: 20/50 periods (major trend confirmation)
โข Quality minimum: 70 points (excellent setups only)
โข Duration Analysis: Heavy emphasis on multi-year historical data
Trading Logic:
Conservative approach focusing on major trend changes. Extended ATR period and high multiplier create SuperTrend that only flips on significant reversals. Very strict quality filters ensure signals represent genuine long-term opportunities.
Signals per month: 1-2 typically
Hold time: Weeks to months
Best for: Long-term investors, set-and-forget approach
"CUSTOM" - Advanced Configuration
Purpose: Complete manual control for experienced traders
Use when: You understand the parameters and want specific optimization
Best for: Testing new approaches, unusual market conditions, specific instruments
Full control over:
โข All SuperTrend parameters
โข Volume thresholds and momentum periods
โข Quality scoring weights
โข analysis mode and multipliers
โข Advanced features tuning
Preset Comparison Quick Reference:
Chart Timeframe: Scalping (1M-5M) | Day Trading (15M-1H) | Swing (4H-D) | Position (D-W)
Signals Frequency: Very High | High | Medium | Low
Hold Duration: Minutes | Hours | Days | Weeks-Months
Quality Threshold: 40 pts | 50 pts | 60 pts | 70 pts
ATR Sensitivity: Highest | Medium | Lower | Lowest
Time Investment: Highest | High | Medium | Lowest
Experience Level: Expert | Advanced | Intermediate | Beginner+
3. QUALITY SCORING SYSTEM (0-70 Points)
Every signal is rated in real-time across three dimensions:
Volume Confirmation (0-30 points):
โข Volume Spike (2.5x+ average): 30 points
โข High Volume (1.5x+ average): 20 points
โข Above Average (1.0x+ average): 10 points
โข Below Average: 0 points
Volatility Assessment (0-30 points):
โข Expanding ATR (1.2x+ average): 30 points
โข Rising ATR (1.0-1.2x average): 15 points
โข Contracting/Stable ATR: 0 points
Volume Momentum (0-10 points):
โข Strong Momentum (1.2x+ ratio): 10 points
โข Rising Momentum (1.0-1.2x ratio): 5 points
โข Weak/Neutral Momentum: 0 points
Score Interpretation:
60-70 points - EXCELLENT:
โข All factors aligned
โข High conviction setup
โข Maximum position size (within risk limits)
โข Primary trading opportunities
45-59 points - STRONG:
โข Multiple confirmations present
โข Above-average setup quality
โข Standard position size
โข Good trading opportunities
30-44 points - GOOD:
โข Basic confirmations met
โข Acceptable setup quality
โข Reduced position size
โข Wait for additional confirmation or trade smaller
Below 30 points - WEAK:
โข Minimal confirmations
โข Low probability setup
โข Consider passing
โข Only for aggressive traders in strong trends
Only signals meeting your minimum quality threshold (configurable per preset) generate alerts and labels.
4. MULTI-TIMEFRAME CONFLUENCE ANALYSIS
The system can simultaneously analyze trend alignment across 6 timeframes (optional feature):
Timeframes analyzed:
โข 5-minute (scalping context)
โข 15-minute (intraday momentum)
โข 1-hour (day trading bias)
โข 4-hour (swing context)
โข Daily (primary trend)
โข Weekly (macro trend)
Confluence Interpretation:
โข 5-6/6 aligned - Very strong multi-timeframe agreement (highest confidence)
โข 3-4/6 aligned - Moderate agreement (standard setup)
โข 1-2/6 aligned - Weak agreement (caution advised)
Dashboard shows real-time alignment count with color-coding. Higher confluence typically correlates with longer, stronger trends.
5. VOLUME MOMENTUM FILTER - Institutional Money Flow
Unlike traditional volume indicators that just measure size, Volume Momentum tracks the RATE OF CHANGE in volume:
How it works:
โข Compares short-term volume average (fast period) to long-term average (slow period)
โข Ratio above 1.0 = Volume accelerating (money flowing IN)
โข Ratio above 1.2 = Strong acceleration (institutional participation likely)
โข Ratio below 0.8 = Volume decelerating (money flowing OUT)
Why it matters:
โข Confirms trend with actual money flow, not just price
โข Leading indicator (volume often leads price)
โข Catches accumulation/distribution before breakouts
โข More intuitive than complex mathematical filters
Integration with signals:
โข Optional filter - can be enabled/disabled per preset
โข When enabled: Only signals with rising volume momentum fire
โข AUTO-DISABLED in Scalping mode (too restrictive for fast trading)
โข Configurable fast/slow periods per trading style
6. ADAPTIVE SUPERTREND MULTIPLIER
Traditional SuperTrend uses fixed ATR multiplier. This system dynamically adjusts the multiplier (0.8x to 1.2x base) based on:
โข Trend Strength: Price correlation over lookback period
โข Volume Weight: Current volume relative to average
Benefits:
โข Tighter bands in calm markets (less premature exits)
โข Wider bands in volatile conditions (avoids whipsaws)
โข Better adaptation to biotech, small-cap, and crypto volatility
โข Optional - can be disabled for classic constant multiplier
7. VISUAL GRADIENT RIBBON
26-layer exponential gradient fill between price and SuperTrend line provides instant visual trend strength assessment:
Color System:
โข Green shades - Bullish trend + volume confirmation (strongest)
โข Blue shades - Bullish trend, normal volume
โข Orange shades - Bearish trend + volume confirmation
โข Red shades - Bearish trend (weakest)
Opacity varies based on:
โข Distance from SuperTrend (farther = more opaque)
โข Volume intensity (higher volume = stronger color)
The ribbon provides at-a-glance trend strength without cluttering your chart. Can be toggled on/off.
8. INTELLIGENT ALERT SYSTEM
Two-tier alert architecture for flexibility:
Automatic Alerts:
โข Fire automatically on BUY and SELL signals
โข Include full context: quality score, volume state, volume momentum
โข One alert per bar close (alert.freq_once_per_bar_close)
โข Message format: "BUY: Supertrend bullish + Quality: 65/70 | Volume: HIGH | Vol Momentum: STRONG (1.35x)"
Customizable Alert Conditions:
โข Appear in TradingView's "Create Alert" dialog
โข Three options: BUY Signal Only, SELL Signal Only, ANY Signal (BUY or SELL)
โข Use TradingView placeholders: {{ticker}}, {{interval}}, {{close}}, {{time}}
โข Fully customizable message templates
All alerts use barstate.isconfirmed - Zero repaint guarantee.
9. ANTI-REPAINT ARCHITECTURE
Every component guaranteed non-repainting:
โข Entry signals: Only appear after bar close
โข duration analysis boxes: Created only on confirmed SuperTrend flips
โข Informative labels: Wait for bar confirmation
โข Alerts: Fire once per closed bar
โข Multi-timeframe data: Uses lookahead=barmerge.lookahead_off
What you see in history is exactly what you would have seen in real-time. No disappearing signals, no changed duration estimates.
HOW TO USE THE INDICATOR
QUICK START - 3 Steps to Trading:
Step 1: Select Your Trading Style
Open indicator settings โ "Quick Setup" section โ Trading Style Preset dropdown
Options:
โข Auto (Detect from TF) - RECOMMENDED: Automatically configures based on your chart timeframe
โข Scalping (1-5m) - For 1-5 minute charts, ultra-fast signals
โข Day Trading (15m-1h) - For 15m-1h charts, balanced approach
โข Swing Trading (4h-D) - For 4h-Daily charts, trend stability
โข Position Trading (D-W) - For Daily-Weekly charts, long-term trends
โข Custom - Manual configuration (advanced users only)
Choose "Auto" and you're done - all parameters optimize automatically.
Step 2: Understand the Signals
BUY Signal (Green Triangle Below Price):
โข SuperTrend flipped bullish
โข Quality score meets minimum threshold (varies by preset)
โข Volume confirmation present (if filter enabled)
โข Volume momentum rising (if filter enabled)
โข duration analysis box shows expected trend duration
SELL Signal (Red Triangle Above Price):
โข SuperTrend flipped bearish
โข Quality score meets minimum threshold
โข Volume confirmation present (if filter enabled)
โข Volume momentum rising (if filter enabled)
โข duration analysis box shows expected trend duration
Duration Analysis Box:
โข Appears at SuperTrend flip (start of new trend)
โข Shows median, average, and range duration estimates
โข Extends to estimated endpoint based on historical data visually
โข Updates mode-specific intelligence (Simple/Standard/Advanced)
Step 3: Use the Dashboard for Context
Dashboard (top-right corner) shows real-time metrics:
โข Row 1 - Quality Score: Current setup rating (0-70)
โข Row 2 - SuperTrend: Direction and current level
โข Row 3 - Volume: Status (Spike/High/Normal/Low) with color
โข Row 4 - Volatility: State (Expanding/Rising/Stable/Contracting)
โข Row 5 - Volume Momentum: Ratio and trend
โข Row 6 - Duration Statistics: Accuracy metrics and track record
Every cell has detailed tooltip - hover for full explanations.
SIGNAL INTERPRETATION BY QUALITY SCORE:
Excellent Setup (60-70 points):
โข Quality Score: 60-70
โข Volume: Spike or High
โข Volatility: Expanding
โข Volume Momentum: Strong (1.2x+)
โข MTF Confluence (if enabled): 5-6/6
โข Action: Primary trade - maximum position size (within risk limits)
โข Statistical reliability: Highest - duration estimates most accurate
Strong Setup (45-59 points):
โข Quality Score: 45-59
โข Volume: High or Above Average
โข Volatility: Rising
โข Volume Momentum: Rising (1.0-1.2x)
โข MTF Confluence (if enabled): 3-4/6
โข Action: Standard trade - normal position size
โข Statistical reliability: Good - duration estimates reliable
Good Setup (30-44 points):
โข Quality Score: 30-44
โข Volume: Above Average
โข Volatility: Stable or Rising
โข Volume Momentum: Neutral to Rising
โข MTF Confluence (if enabled): 3-4/6
โข Action: Cautious trade - reduced position size, wait for additional confirmation
โข Statistical reliability: Moderate - duration estimates less certain
Weak Setup (Below 30 points):
โข Quality Score: Below 30
โข Volume: Low or Normal
โข Volatility: Contracting or Stable
โข Volume Momentum: Weak
โข MTF Confluence (if enabled): 1-2/6
โข Action: Pass or wait for improvement
โข Statistical reliability: Low - duration estimates unreliable
USING duration analysis boxES FOR TRADE MANAGEMENT:
Entry Timing:
โข Enter on SuperTrend flip (signal bar close)
โข duration analysis box appears simultaneously
โข Note the median duration - this is your expected hold time
Profit Targets:
โข Conservative: Use MEDIAN duration as profit target (50% probability)
โข Moderate: Use AVERAGE duration (mean of similar trends)
โข Aggressive: Aim for MAX duration from range (best historical outcome)
Position Management:
โข Scale out at median duration (take partial profits)
โข Trail stop as trend extends beyond median
โข Full exit at average duration or SuperTrend flip (whichever comes first)
โข Re-evaluate if trend exceeds estimated range
analysis mode Selection:
โข Simple: Clean trending markets, beginners, minimal complexity
โข Standard: Most markets, most traders (recommended default)
โข Advanced: Volatile markets, complex instruments, experienced traders seeking highest accuracy
Asset Type Configuration (Advanced Mode):
If using Advanced analysis mode, configure Asset Type for optimal accuracy:
โข Small Cap: Stocks under $2B market cap, low liquidity
โข Biotech / Speculative: Clinical-stage pharma, penny stocks, high-risk
โข Blue Chip / Large Cap: S&P 500, mega-cap tech, stable large companies
โข Tech Growth: High-growth tech (TSLA, NVDA, growth SaaS)
โข Dividend / Value: Dividend aristocrats, value stocks, utilities
โข Cyclical: Energy, materials, industrials (macro-driven)
โข Crypto / High Volatility: Bitcoin, altcoins, highly volatile assets
Correct asset type selection improves Statistical accuracy by 15-20%.
RISK MANAGEMENT GUIDELINES:
1. Stop Loss Placement:
Long positions:
โข Place stop below recent swing low OR
โข Place stop below SuperTrend level (whichever is tighter)
โข Use 1-2 ATR distance as guideline
โข Recommended: SuperTrend level (built-in volatility adjustment)
Short positions:
โข Place stop above recent swing high OR
โข Place stop above SuperTrend level (whichever is tighter)
โข Use 1-2 ATR distance as guideline
โข Recommended: SuperTrend level
2. Position Sizing by Quality Score:
โข Excellent (60-70): Maximum position size (2% risk per trade)
โข Strong (45-59): Standard position size (1.5% risk per trade)
โข Good (30-44): Reduced position size (1% risk per trade)
โข Weak (Below 30): Pass or micro position (0.5% risk - learning trades only)
3. Exit Strategy Options:
Option A - Statistical Duration-Based Exit:
โข Exit at median estimated duration (conservative)
โข Exit at average estimated duration (moderate)
โข Trail stop beyond average duration (aggressive)
Option B - Signal-Based Exit:
โข Exit on opposite signal (SELL after BUY, or vice versa)
โข Exit on SuperTrend flip (trend reversal)
โข Exit if quality score drops below 30 mid-trend
Option C - Hybrid (Recommended):
โข Take 50% profit at median estimated duration
โข Trail stop on remaining 50% using SuperTrend as trailing level
โข Full exit on SuperTrend flip or quality collapse
4. Trade Filtering:
For higher win-rate (fewer trades, better quality):
โข Increase minimum quality score (try 60 for swing, 50 for day trading)
โข Enable volume momentum filter (ensure institutional participation)
โข Require higher MTF confluence (5-6/6 alignment)
โข Use Advanced analysis mode with appropriate asset type
For more opportunities (more trades, lower quality threshold):
โข Decrease minimum quality score (40 for day trading, 35 for scalping)
โข Disable volume momentum filter
โข Lower MTF confluence requirement
โข Use Simple or Standard analysis mode
SETTINGS OVERVIEW
Quick Setup Section:
โข Trading Style Preset: Auto / Scalping / Day Trading / Swing / Position / Custom
Dashboard & Display:
โข Show Dashboard (ON/OFF)
โข Dashboard Position (9 options: Top/Middle/Bottom + Left/Center/Right)
โข Text Size (Auto/Tiny/Small/Normal/Large/Huge)
โข Show Ribbon Fill (ON/OFF)
โข Show SuperTrend Line (ON/OFF)
โข Bullish Color (default: Green)
โข Bearish Color (default: Red)
โข Show Entry Labels - BUY/SELL signals (ON/OFF)
โข Show Info Labels - Volume events (ON/OFF)
โข Label Size (Auto/Tiny/Small/Normal/Large/Huge)
Supertrend Configuration:
โข ATR Length (default varies by preset: 7-21)
โข ATR Multiplier Base (default varies by preset: 2.0-4.0)
โข Use Adaptive Multiplier (ON/OFF) - Dynamic 0.8x-1.2x adjustment
โข Smoothing Factor (0.0-0.5) - EMA smoothing applied to bands
โข Neutral Bars After Flip (0-10) - Hide ST immediately after flip
Volume Momentum:
โข Enable Volume Momentum Filter (ON/OFF)
โข Fast Period (default varies by preset: 3-20)
โข Slow Period (default varies by preset: 10-50)
Volume Analysis:
โข Volume MA Length (default varies by preset: 10-50)
โข High Volume Threshold (default: 1.5x)
โข Spike Threshold (default: 2.5x)
โข Low Volume Threshold (default: 0.7x)
Quality Filters:
โข Minimum Quality Score (0-70, varies by preset)
โข Require Volume Confirmation (ON/OFF)
Trend Duration Analysis:
โข Show Duration Analysis (ON/OFF) - Display duration analysis boxes
โข analysis mode - Simple / Standard / Advanced
โข Asset Type - 7 options (Small Cap, Biotech, Blue Chip, Tech Growth, Dividend, Cyclical, Crypto)
โข Use Exponential Weighting (ON/OFF) - Recent trends weighted more
โข Decay Factor (0.5-0.99) - How much more recent trends matter
โข Structure Lookback (3-30) - Pivot detection period for support/resistance
โข Proximity Threshold (xATR) - How close to level qualifies as "near"
โข Enable Error Learning (ON/OFF) - System learns from estimation errors
โข Memory Depth (3-20) - How many past errors to remember
Box Visual Settings:
โข duration analysis box Border Color
โข duration analysis box Background Color
โข duration analysis box Text Color
โข duration analysis box Border Width
โข duration analysis box Transparency
Multi-Timeframe (Optional Feature):
โข Enable MTF Confluence (ON/OFF)
โข Minimum Alignment Required (0-6)
โข Individual timeframe enable/disable toggles
โข Custom timeframe selection options
All preset configurations override manual inputs except when "Custom" is selected.
ADVANCED FEATURES
1. Scalpel Mode (Optional)
Advanced pullback entry system that waits for healthy retracements within established trends before signaling entry:
โข Monitors price distance from SuperTrend levels
โข Requires pullback to configurable range (default: 30-50%)
โข Ensures trend remains intact before entry signal
โข Reduces whipsaw and false breakouts
โข Inspired by Mark Minervini's VCP pullback entries
Best for: Swing traders and day traders seeking precision entries
Scalpers: Consider disabling for faster entries
2. Error Learning System (Advanced analysis mode Only)
The system learns from its own estimation errors:
โข Tracks last 10-20 completed duration estimates (configurable memory depth)
โข Calculates error ratio for each: estimated duration / Actual Duration
โข If system consistently over-estimates: Applies negative correction (-15%)
โข If system consistently under-estimates: Applies positive correction (+15%)
โข Adapts to current market regime automatically
This self-correction mechanism improves accuracy over time as the system gathers more data on your specific symbol and timeframe.
3. Regime Detection (Advanced analysis mode Only)
Automatically detects whether market is in trending or choppy regime:
โข Compares last 3 trends to historical average
โข Recent trends 20%+ longer โ Trending regime (+20% to estimates)
โข Recent trends 20%+ shorter โ Choppy regime (-20% to estimates)
โข Applied separately to bullish and bearish trends
Helps duration estimates adapt to changing market conditions without manual intervention.
4. Exponential Weighting
Option to weight recent trends more heavily than distant history:
โข Default decay factor: 0.9
โข Recent trends get higher weight in statistical calculations
โข Older trends gradually decay in importance
โข Rationale: Recent market behavior more relevant than old data
โข Can be disabled for equal weighting
5. Backtest Statistics
System backtests its own duration estimates using historical data:
โข Walks through past trends chronologically
โข Calculates what duration estimate WOULD have been at each flip
โข Compares to actual duration that occurred
โข Displays accuracy metrics in duration analysis boxes and dashboard
โข Helps assess statistical reliability on your specific chart
Note: Backtest uses only data available AT THE TIME of each historical flip (no lookahead bias).
TECHNICAL SPECIFICATIONS
โข Pine Script Version: v6
โข Indicator Type: Overlay (draws on price chart)
โข Max Boxes: 500 (for duration analysis box storage)
โข Max Bars Back: 5000 (for comprehensive historical analysis)
โข Security Calls: 1 (for MTF if enabled - optimized)
โข Repainting: NO - All signals and duration estimates confirmed on bar close
โข Lookahead Bias: NO - All HTF data properly offset, all duration estimates use only historical data
โข Real-time Updates: YES - Dashboard and quality scores update live
โข Alert Capable: YES - Both automatic alerts and customizable alert conditions
โข Multi-Symbol: Works on stocks, crypto, forex, futures, indices
Performance Optimization:
โข Conditional calculations (duration analysis can be disabled to reduce load)
โข Efficient array management (circular buffers for trend storage)
โข Streamlined gradient rendering (26 layers, can be toggled off)
โข Smart label cooldown system (prevents label spam)
โข Optimized similarity matching (analyzes only relevant trends)
Data Requirements:
โข Minimum 50-100 bars for initial duration analysis (builds historical database)
โข Optimal: 500+ bars for robust statistical analysis
โข Longer history = more accurate duration estimates
โข Works on any timeframe from 1 minute to monthly
KNOWN LIMITATIONS
โข Trending Markets Only: Performs best in clear trends. May generate false signals in choppy/sideways markets (use quality score filtering and regime detection to mitigate)
โข Lagging Nature: Like all trend-following systems, signals occur AFTER trend establishment, not at exact tops/bottoms. Use duration analysis boxes to set realistic profit targets.
โข Initial Learning Period: Duration analysis system requires 10-15 completed trends to build reliable historical database. Early duration estimates less accurate (first few weeks on new symbol/timeframe).
โข Visual Load: 26-layer gradient ribbon may slow performance on older devices. Disable ribbon if experiencing lag.
โข Statistical accuracy Variables: Duration estimates are statistical estimates, not guarantees. Accuracy varies by:
- Market regime (trending vs choppy)
- Asset volatility characteristics
- Quality of historical pattern matches
- Timeframe traded (higher TF = more reliable)
โข Not Best Suitable For:
- Ultra-short-term scalping (sub-1-minute charts)
- Mean-reversion strategies (designed for trend-following)
- Range-bound trading (requires trending conditions)
- News-driven spikes (estimates based on technical patterns, not fundamentals)
FREQUENTLY ASKED QUESTIONS
Q: Does this indicator repaint?
A: Absolutely not. All signals, duration analysis boxes, labels, and alerts use barstate.isconfirmed checks. They only appear after the bar closes. What you see in history is exactly what you would have seen in real-time. Zero repaint guarantee.
Q: How accurate are the trend duration estimates?
A: Accuracy varies by mode, market conditions, and historical data quality:
โข Simple mode: 60-70% accuracy (within ยฑ20% of actual duration)
โข Standard mode: 70-80% accuracy (within ยฑ20% of actual duration)
โข Advanced mode: 75-85% accuracy (within ยฑ20% of actual duration)
Best accuracy achieved on:
โข Higher timeframes (4H, Daily, Weekly)
โข Trending markets (not choppy/sideways)
โข Assets with consistent behavior (Blue Chip, Large Cap)
โข After 20+ historical trends analyzed (builds robust database)
Remember: All duration estimates are statistical calculations based on historical patterns, not guarantees.
Q: Which analysis mode should I use?
A:
โข Simple: Beginners, clean trending markets, want minimal complexity
โข Standard: Most traders, general market conditions (RECOMMENDED DEFAULT)
โข Advanced: Experienced traders, volatile/complex markets (biotech, small-cap, crypto), seeking maximum accuracy
Advanced mode requires correct Asset Type configuration for optimal results.
Q: What's the difference between the trading style presets?
A: Each preset optimizes ALL parameters for a specific trading approach:
โข Scalping: Ultra-sensitive (ATR 7, Mult 2.0), more signals, shorter holds
โข Day Trading: Balanced (ATR 10, Mult 2.5), moderate signals, intraday holds
โข Swing Trading: Stable (ATR 14, Mult 3.0), fewer signals, multi-day holds
โข Position Trading: Very stable (ATR 21, Mult 4.0), rare signals, week/month holds
Auto mode automatically selects based on your chart timeframe.
Q: Should I use Auto mode or manually select a preset?
A: Auto mode is recommended for most traders. It automatically matches settings to your timeframe and re-optimizes if you switch charts. Only use manual preset selection if:
โข You want scalping settings on a 15m chart (overriding auto-detection)
โข You want swing settings on a 1h chart (more conservative than auto would give)
โข You're testing different approaches on same timeframe
Q: Can I use this for scalping and day trading?
A: Absolutely! The preset system is specifically designed for all trading styles:
โข Select "Scalping (1-5m)" for 1-5 minute charts
โข Select "Day Trading (15m-1h)" for 15m-1h charts
โข Or use "Auto" mode and it configures automatically
Volume momentum filter is auto-disabled in Scalping mode for faster signals.
Q: What is Volume Momentum and why does it matter?
A: Volume Momentum compares short-term volume (fast MA) to long-term volume (slow MA). It answers: "Is money flowing into this asset faster now than historically?"
Why it matters:
โข Volume often leads price (early warning system)
โข Confirms institutional participation (smart money)
โข No lag like price-based indicators
โข More intuitive than complex mathematical filters
When the ratio is above 1.2, you have strong evidence that institutions are accumulating (bullish) or distributing (bearish).
Q: How do I set up alerts?
A: Two options:
Option 1 - Automatic Alerts:
1. Right-click on chart โ Add Alert
2. Condition: Select this indicator
3. Choose "Any alert() function call"
4. Configure notification method (app, email, webhook)
5. You'll receive detailed alerts on every BUY and SELL signal
Option 2 - Customizable Alert Conditions:
1. Right-click on chart โ Add Alert
2. Condition: Select this indicator
3. You'll see three options in dropdown:
- "BUY Signal" (long signals only)
- "SELL Signal" (short signals only)
- "ANY Signal" (both BUY and SELL)
4. Choose desired option and customize message template
5. Uses TradingView placeholders: {{ticker}}, {{close}}, {{time}}, etc.
All alerts fire only on confirmed bar close (no repaint).
Q: What is Scalpel Mode and should I use it?
A: Scalpel Mode waits for healthy pullbacks within established trends before signaling entry. It reduces whipsaws and improves entry timing.
Recommended ON for:
โข Swing traders (want precision entries on pullbacks)
โข Day traders (willing to wait for better prices)
โข Risk-averse traders (prefer fewer but higher-quality entries)
Recommended OFF for:
โข Scalpers (need immediate entries, can't wait for pullbacks)
โข Momentum traders (want to enter on breakout, not pullback)
โข Aggressive traders (prefer more opportunities over precision)
Q: Why do some duration estimates show wider ranges than others?
A: Range width reflects historical trend variability:
โข Narrow range: Similar historical trends had consistent durations (high confidence)
โข Wide range: Similar historical trends had varying durations (lower confidence)
Wide ranges often occur:
โข Early in analysis (fewer historical trends to learn from)
โข In volatile/choppy markets (inconsistent trend behavior)
โข On lower timeframes (more noise, less consistency)
The median and average still provide useful targets even when range is wide.
Q: Can I customize the dashboard position and appearance?
A: Yes! Dashboard settings include:
โข Position: 9 options (Top/Middle/Bottom + Left/Center/Right)
โข Text Size: Auto, Tiny, Small, Normal, Large, Huge
โข Show/Hide: Toggle entire dashboard on/off
Choose position that doesn't overlap important price action on your specific chart.
Q: Which timeframe should I trade on?
A: Depends on your trading style and time availability:
โข 1-5 minute: Active scalping, requires constant monitoring
โข 15m-1h: Day trading, check few times per session
โข 4h-Daily: Swing trading, check once or twice daily
โข Daily-Weekly: Position trading, check weekly
General principle: Higher timeframes produce:
โข Fewer signals (less frequent)
โข Higher quality setups (stronger confirmations)
โข More reliable duration estimates (better statistical data)
โข Less noise (clearer trends)
Start with Daily chart if new to trading. Move to lower timeframes as you gain experience.
Q: Does this work on all markets (stocks, crypto, forex)?
A: Yes, it works on all markets with trending characteristics:
Excellent for:
โข Stocks (especially growth and momentum names)
โข Crypto (BTC, ETH, major altcoins)
โข Futures (indices, commodities)
โข Forex majors (EUR/USD, GBP/USD, etc.)
Best results on:
โข Trending markets (not range-bound)
โข Liquid instruments (tight spreads, good fills)
โข Volatile assets (clear trend development)
Less effective on:
โข Range-bound/sideways markets
โข Ultra-low volatility instruments
โข Illiquid small-caps (use caution)
Configure Asset Type (in Advanced analysis mode) to match your instrument for best accuracy.
Q: How many signals should I expect per day/week?
A: Highly variable based on:
By Timeframe:
โข 1-5 minute: 5-15 signals per session
โข 15m-1h: 2-5 signals per day
โข 4h-Daily: 2-5 signals per week
โข Daily-Weekly: 1-2 signals per month
By Market Volatility:
โข High volatility = more SuperTrend flips = more signals
โข Low volatility = fewer flips = fewer signals
By Quality Filter:
โข Higher threshold (60-70) = fewer but better signals
โข Lower threshold (30-40) = more signals, lower quality
By Volume Momentum Filter:
โข Enabled = Fewer signals (only volume-confirmed)
โข Disabled = More signals (all SuperTrend flips)
Adjust quality threshold and filters to match your desired signal frequency.
Q: What's the difference between entry labels and info labels?
A:
Entry Labels (BUY/SELL):
โข Your primary trading signals
โข Based on SuperTrend flip + all confirmations (quality, volume, momentum)
โข Include quality score and confirmation icons
โข These are actionable entry points
Info Labels (Volume Spike):
โข Additional market context
โข Show volume events that may support or contradict trend
โข 8-bar cooldown to prevent spam
โข NOT necessarily entry points - contextual information only
Control separately: Can show entry labels without info labels (recommended for clean charts).
Q: Can I combine this with other indicators?
A: Absolutely! This works well with:
โข RSI: For divergences and overbought/oversold conditions
โข Support/Resistance: Confluence with key levels
โข Fibonacci Retracements: Pullback targets in Scalpel Mode
โข Price Action Patterns: Flags, pennants, cup-and-handle
โข MACD: Additional momentum confirmation
โข Bollinger Bands: Volatility context
This indicator provides trend direction and duration estimates - complement with other tools for entry refinement and additional confluence.
Q: Why did I get a low-quality signal? Can I filter them out?
A: Yes! Increase the Minimum Quality Score in settings.
If you're seeing signals with quality below your preference:
โข Day Trading: Set minimum to 50
โข Swing Trading: Set minimum to 60
โข Position Trading: Set minimum to 70
Only signals meeting the threshold will appear. This reduces frequency but improves win-rate.
Q: How do I interpret the MTF Confluence count?
A: Shows how many of 6 timeframes agree with current trend:
โข 6/6 aligned: Perfect agreement (extremely rare, highest confidence)
โข 5/6 aligned: Very strong alignment (high confidence)
โข 4/6 aligned: Good alignment (standard quality setup)
โข 3/6 aligned: Moderate alignment (acceptable)
โข 2/6 aligned: Weak alignment (caution)
โข 1/6 aligned: Very weak (likely counter-trend)
Higher confluence typically correlates with longer, stronger trends. However, MTF analysis is optional - you can disable it and rely solely on quality scoring.
Q: Is this suitable for beginners?
A: Yes, but requires foundational knowledge:
You should understand:
โข Basic trend-following concepts (higher highs, higher lows)
โข Risk management principles (position sizing, stop losses)
โข How to read candlestick charts
โข What volume and volatility mean
Beginner-friendly features:
โข Auto preset mode (zero configuration)
โข Quality scoring (tells you signal strength)
โข Dashboard tooltips (hover for explanations)
โข duration analysis boxes (visual profit targets)
Recommended for beginners:
1. Start with "Auto" or "Swing Trading" preset on Daily chart
2. Use Standard Analysis Mode (not Advanced)
3. Set minimum quality to 60 (fewer but better signals)
4. Paper trade first for 2-4 weeks
5. Study methodology references (Minervini, O'Neil, Zanger)
Q: What is the Asset Type setting and why does it matter?
A: Asset Type (in Advanced analysis mode) adjusts duration estimates based on volatility characteristics:
โข Small Cap: Explosive moves, extended trends (+30-40%)
โข Biotech / Speculative: Parabolic potential, news-driven (+40%)
โข Blue Chip / Large Cap: Baseline, steady trends (0% adjustment)
โข Tech Growth: Momentum-driven, longer trends (+20%)
โข Dividend / Value: Slower, grinding trends (-20%)
โข Cyclical: Macro-driven, variable (ยฑ10%)
โข Crypto / High Volatility: Parabolic potential (+30%)
Correct configuration improves Statistical accuracy by 15-20%. Using Blue Chip settings on a biotech stock may underestimate trend length (you'll exit too early).
Q: Can I backtest this indicator?
A: Yes! TradingView's Strategy Tester works with this indicator's signals.
To backtest:
1. Note the entry conditions (SuperTrend flip + quality threshold + filters)
2. Create a strategy script using same logic
3. Run Strategy Tester on historical data
Additionally, the indicator includes BUILT-IN duration estimate validation:
โข System backtests its own duration estimates
โข Shows accuracy metrics in dashboard and duration analysis boxes
โข Helps assess reliability on your specific symbol/timeframe
Q: Why does Volume Momentum auto-disable in Scalping mode?
A: Scalping requires ultra-fast entries to catch quick moves. Volume Momentum filter adds friction by requiring volume confirmation before signaling, which can cause missed opportunities in rapid scalping.
Scalping preset is optimized for speed and frequency - the filter is counterproductive for that style. It remains enabled for Day Trading, Swing Trading, and Position Trading presets where patience improves results.
You can manually enable it in Custom mode if desired.
Q: How much historical data do I need for accurate duration estimates?
A:
Minimum: 50-100 bars (indicator will function but duration estimates less reliable)
Recommended: 500+ bars (robust statistical database)
Optimal: 1000+ bars (maximum Statistical accuracy)
More history = more completed trends = better pattern matching = more accurate duration estimates.
New symbols or newly-switched timeframes will have lower Statistical accuracy initially. Allow 2-4 weeks for the system to build historical database.
IMPORTANT DISCLAIMERS
No Guarantee of Profit:
This indicator is an educational tool and does not guarantee any specific trading results. All trading involves substantial risk of loss. Duration estimates are statistical calculations based on historical patterns and are not guarantees of future performance.
Past Performance:
Historical backtest results and Statistical accuracy statistics do not guarantee future performance. Market conditions change constantly. What worked historically may not work in current or future markets.
Not Financial Advice:
This indicator provides technical analysis signals and statistical duration estimates only. It is not financial, investment, or trading advice. Always consult with a qualified financial advisor before making investment decisions.
Risk Warning:
Trading stocks, options, futures, forex, and cryptocurrencies involves significant risk. You can lose all of your invested capital. Never trade with money you cannot afford to lose. Only risk capital you can lose without affecting your lifestyle.
Testing Required:
Always test this indicator on a demo account or with paper trading before risking real capital. Understand how it works in different market conditions. Verify Statistical accuracy on your specific instruments and timeframes before trusting it with real money.
User Responsibility:
You are solely responsible for your trading decisions. The developer assumes no liability for trading losses, incorrect duration estimates, software errors, or any other damages incurred while using this indicator.
Statistical Estimation Limitations:
Trend Duration estimates are statistical estimates based on historical pattern matching. They are NOT guarantees. Actual trend durations may differ significantly from duration estimates due to unforeseen news events, market regime changes, or lack of historical precedent for current conditions.
CREDITS & ACKNOWLEDGMENTS
Methodology Inspiration:
โข Mark Minervini - Volatility Contraction Pattern (VCP) concepts and pullback entry techniques
โข William O'Neil - Volume analysis principles and CANSLIM institutional buying patterns
โข Dan Zanger - Momentum breakout strategies and volatility expansion entries
Technical Components:
โข SuperTrend calculation - Classic ATR-based trend indicator (public domain)
โข Statistical analysis - Standard median, average, range calculations
โข k-Nearest Neighbors - Classic machine learning similarity matching concept
โข Multi-timeframe analysis - Standard request.security implementation in Pine Script
For questions, feedback, or support, please comment below or send a private message.
Happy Trading!
Pine Scriptยฎ indicator
Opening Range Breakout with Multi-Timeframe Liquidity]โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
OPENING RANGE BREAKOUT WITH MULTI-TIMEFRAME LIQUIDITY
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
A professional Opening Range Breakout (ORB) indicator enhanced with multi-timeframe liquidity detection, trading session visualization, volume analysis, and trend confirmation tools. Designed for intraday trading with comprehensive alert system.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
WHAT THIS INDICATOR DOES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator combines multiple trading concepts:
- Opening Range Breakout (ORB) - Customizable time period detection with automatic high/low identification
- Multi-Timeframe Liquidity - HTF (Higher Timeframe) and LTF (Lower Timeframe) key level detection
- Trading Sessions - Tokyo, London, New York, and Sydney session visualization
- Volume Analysis - Volume spike detection and strength measurement
- Multi-Timeframe Confirmation - Trend bias from higher timeframes
- EMA Integration - Trend filter and dynamic support/resistance
- Smart Alerts - Quality-filtered breakout notifications
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
HOW IT WORKS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
OPENING RANGE BREAKOUT (ORB):
Concept:
The Opening Range is a period at the start of a trading session where price establishes an initial high and low. Breakouts beyond this range often indicate the direction of the day's trend.
Detection Method:
- Default: 15-minute opening range (configurable)
- Custom Range: Set specific session times with timezone support
- Automatically identifies ORH (Opening Range High) and ORL (Opening Range Low)
- Tracks ORB mid-point for reference
Range Establishment:
1. Session starts (or custom time begins)
2. Tracks highest high and lowest low during the period
3. Range confirmed at end of opening period
4. Levels extend throughout the session
Breakout Detection:
- Bullish Breakout: Close above ORH
- Bearish Breakout: Close below ORL
- Mid-point acts as bias indicator
Visual Display:
- Shaded box during range formation
- Horizontal lines for ORH, ORL, and mid-point
- Labels showing level values
- Color-coded fills based on selected method
Fill Color Methods:
1. Session Comparison:
- Green: Current OR mid > Previous OR mid
- Red: Current OR mid < Previous OR mid
- Gray: Equal or first session
- Shows day-over-day momentum
2. Breakout Direction (Recommended):
- Green: Price currently above ORH (bullish breakout)
- Red: Price currently below ORL (bearish breakout)
- Gray: Price inside range (no breakout)
- Real-time breakout status
MULTI-TIMEFRAME LIQUIDITY:
Two-Tier System for comprehensive level identification:
HTF (Higher Timeframe) Key Liquidity:
- Default: 4H timeframe (configurable to Daily, Weekly)
- Identifies major institutional levels
- Uses pivot detection with adjustable parameters
- Suitable for swing highs/lows where large orders rest
LTF (Lower Timeframe) Key Liquidity:
- Default: 1H timeframe (configurable)
- Provides precision entry/exit levels
- Finer granularity for intraday trading
- Captures minor swing points
Calculation Method:
- Pivot high/low detection algorithm
- Configurable left bars (lookback) and right bars (confirmation)
- Timeframe multiplier for accurate multi-timeframe detection
- Automatic level extension
Mitigation System:
- Tracks when levels are swept (broken)
- Configurable mitigation type: Wick or Close-based
- Option to remove or show mitigated levels
- Display limit prevents chart clutter
Asset-Specific Optimization:
The indicator includes quick reference settings for different assets:
- Major Forex (EUR/USD, GBP/USD): Default settings optimal
- Crypto (BTC/ETH): Left=12, Right=4, Display=7
- Gold: HTF=1D, Left=20
TRADING SESSIONS:
Four Major Sessions with Full Customization:
Tokyo Session:
- Default: 04:00-13:00 UTC+4
- Asian trading hours
- Often sets daily range
London Session:
- Default: 11:00-20:00 UTC+4
- Highest liquidity period
- Major institutional activity
New York Session:
- Default: 16:00-01:00 UTC+4
- US market hours
- High-impact news events
Sydney Session:
- Default: 01:00-10:00 UTC+4
- Earliest Asian activity
- Lower volatility
Session Features:
- Shaded background boxes
- Session name labels
- Optional open/close lines
- Session high/low tracking with colored lines
- Each session has independent color settings
- Fully customizable times and timezones
VOLUME ANALYSIS:
Volume-Based Trade Confirmation:
Volume MA:
- Configurable period (default: 20)
- Establishes average volume baseline
- Used for spike detection
Volume Spike Detection:
- Identifies when volume exceeds MA * multiplier
- Default: 1.5x average volume
- Confirms breakout strength
Volume Strength Measurement:
- Calculates current volume as percentage of average
- Shows relative volume intensity
- Used in alert quality filtering
High Volume Bars:
- Identifies bars above 50th percentile
- Additional confirmation layer
- Indicates institutional participation
MULTI-TIMEFRAME CONFIRMATION:
Trend Bias from Higher Timeframes:
HTF 1 (Trend):
- Default: 1H timeframe
- Uses EMA to determine intermediate trend
- Compares current timeframe EMA to HTF EMA
HTF 2 (Bias):
- Default: 4H timeframe
- Uses 50 EMA for longer-term bias
- Confirms overall market direction
Bias Classifications:
- Bullish Bias: HTF close > HTF 50 EMA AND Current EMA > HTF1 EMA
- Bearish Bias: HTF close < HTF 50 EMA AND Current EMA < HTF1 EMA
- Neutral Bias: Mixed signals between timeframes
EMA Stack Analysis:
- Compares EMA alignment across timeframes
- +1: Bullish stack (lower TF EMA > higher TF EMA)
- -1: Bearish stack (lower TF EMA < higher TF EMA)
- 0: Neutral/crossed
Usage:
- Filters false breakouts
- Confirms trend direction
- Improves trade quality
EMA INTEGRATION:
Dynamic EMA for Trend Reference:
Features:
- Configurable period (default: 20)
- Customizable color and width
- Acts as dynamic support/resistance
- Trend filter for ORB trades
Application:
- Above EMA: Favor long breakouts
- Below EMA: Favor short breakouts
- EMA cross: Potential trend change
- Distance from EMA: Momentum gauge
SMART ALERT SYSTEM:
Quality-Filtered Breakout Notifications:
Alert Types:
1. Standard ORB Breakout
2. High Quality ORB Breakout
Quality Criteria:
- Volume Confirmation: Volume > 1.2x average
- MTF Confirmation: Bias aligned with breakout direction
Standard Alert:
- Basic breakout detection
- Price crosses ORH or ORL
- Icon: ๐ (bullish) or ๐ป (bearish)
High Quality Alert:
- Both volume AND MTF confirmed
- Stronger probability setup
- Icon: ๐โญ (bullish) or ๐ปโญ (bearish)
Alert Information Includes:
- Alert quality rating
- Breakout level and current price
- Volume strength percentage (if enabled)
- MTF bias status (if enabled)
- Recommended action
One Alert Per Bar:
- Prevents alert spam
- Uses flag system to track sent alerts
- Resets on new ORB session
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
HOW TO USE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
OPENING RANGE SETUP:
Basic Configuration:
1. Select time period for opening range (default: 15 minutes)
2. Choose fill color method (Breakout Direction recommended)
3. Enable historical data display if needed
Custom Range (Advanced):
1. Enable Custom Range toggle
2. Set specific session time (e.g., 0930-0945)
3. Select appropriate timezone
4. Useful for specific market opens (NYSE, LSE, etc.)
LIQUIDITY LEVELS SETUP:
Quick Configuration by Asset:
- Forex: Use default settings (Left=15, Right=5)
- Crypto: Set Left=12, Right=4, Display=7
- Gold: Set HTF=1D, Left=20
HTF Liquidity:
- Purpose: Major support/resistance levels
- Recommended: 4H for day trading, 1D for swing trading
- Use as profit targets or reversal zones
LTF Liquidity:
- Purpose: Entry/exit refinement
- Recommended: 1H for day trading, 4H for swing trading
- Use for position management
Mitigation Settings:
- Wick-based: More sensitive (default)
- Close-based: More conservative
- Remove or Show mitigated levels based on preference
TRADING SESSIONS SETUP:
Enable/Disable Sessions:
- Master toggle for all sessions
- Individual session controls
- Show/hide session names
Session High/Low Lines:
- Enable to see session extremes
- Each session has custom colors
- Useful for range trading
Customization:
- Adjust session times for your broker
- Set timezone to match your location
- Customize colors for visibility
VOLUME ANALYSIS SETUP:
Enable Volume Analysis:
1. Toggle on Volume Analysis
2. Set MA length (20 recommended)
3. Adjust spike multiplier (1.5 typical)
Usage:
- Confirm breakouts with volume
- Identify climactic moves
- Filter false signals
MULTI-TIMEFRAME SETUP:
HTF Selection:
- HTF 1 (Trend): 1H for day trading, 4H for swing
- HTF 2 (Bias): 4H for day trading, 1D for swing
Interpretation:
- Trade only with bias alignment
- Neutral bias: Be cautious
- Bias changes: Potential reversals
EMA SETUP:
Configuration:
- Period: 20 for responsive, 50 for smoother
- Color: Choose contrasting color
- Width: 1-2 for visibility
Usage:
- Filter trades: Long above, Short below
- Dynamic support/resistance reference
- Trend confirmation
ALERT SETUP:
TradingView Alert Creation:
1. Enable alerts in indicator settings
2. Enable ORB Breakout Alerts
3. Right-click chart โ Add Alert
4. Select this indicator
5. Choose "Any alert() function call"
6. Configure delivery method (mobile, email, webhook)
Alert Filtering:
- All alerts include quality rating
- High Quality alerts = Volume + MTF confirmed
- Standard alerts = Basic breakout only
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
TRADING STRATEGIES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CLASSIC ORB STRATEGY:
Setup:
1. Wait for opening range to complete
2. Price breaks and closes above ORH or below ORL
3. Volume > average (if enabled)
4. MTF bias aligned (if enabled)
Entry:
- Bullish: Buy on break above ORH
- Bearish: Sell on break below ORL
- Consider retest entries for better risk/reward
Stop Loss:
- Bullish: Below ORL or range mid-point
- Bearish: Above ORH or range mid-point
- Adjust based on volatility
Targets:
- Initial: Range width extension (ORH + range width)
- Secondary: HTF liquidity levels
- Final: Session high/low or major support/resistance
ORB + LIQUIDITY CONFLUENCE:
Enhanced Setup:
1. Opening range established
2. HTF liquidity level near or beyond ORH/ORL
3. Breakout occurs with volume
4. Price targets the liquidity level
Entry:
- Enter on ORB breakout
- Target the HTF liquidity level
- Use LTF liquidity for position management
Management:
- Partial profits at ORB + range width
- Move stop to breakeven at LTF liquidity
- Final exit at HTF liquidity sweep
ORB REJECTION STRATEGY (Counter-Trend):
Setup:
1. Price breaks above ORH or below ORL
2. Weak volume (below average)
3. MTF bias opposite to breakout
4. Price closes back inside range
Entry:
- Failed bullish break: Short below ORH
- Failed bearish break: Long above ORL
Stop Loss:
- Beyond the failed breakout level
- Or beyond session extreme
Target:
- Opposite end of opening range
- Range mid-point for partial profit
SESSION-BASED ORB TRADING:
Tokyo Session:
- Typically narrower ranges
- Good for range trading
- Wait for London open breakout
London Session:
- Highest volume and volatility
- Strong ORB setups
- Major liquidity sweeps common
New York Session:
- Strong trending moves
- News-driven volatility
- Good for momentum trades
Sydney Session:
- Quieter conditions
- Suitable for range strategies
- Sets up Tokyo session
EMA-FILTERED ORB:
Rules:
- Only take bullish breaks if price > EMA
- Only take bearish breaks if price < EMA
- Ignore counter-trend breaks
Benefits:
- Reduces false signals
- Aligns with larger trend
- Improves win rate
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CONFIGURATION GUIDE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
OPENING RANGE SETTINGS:
Time Period:
- 15 min: Standard for most markets
- 30 min: Wider range, fewer breakouts
- 60 min: For slower markets or swing trades
Custom Range:
- Use for specific market opens
- NYSE: 0930-1000 EST
- LSE: 0800-0830 GMT
- Set timezone to match exchange
Historical Display:
- Enable: See all previous session data
- Disable: Cleaner chart, current session only
LIQUIDITY SETTINGS:
Left Bars (5-30):
- Lower: More frequent, sensitive levels
- Higher: Fewer, more significant levels
- Recommended: 15 for most markets
Right Bars (1-25):
- Confirmation period
- Higher: More reliable, less frequent
- Recommended: 5 for balance
Display Limit (1-20):
- Number of active levels shown
- Higher: More context, busier chart
- Recommended: 7 for clarity
Extension Options:
- Short: Levels visible near formation
- Current: Extended to current bar (recommended)
- Max: Extended indefinitely
VOLUME SETTINGS:
MA Length (5-50):
- Shorter: More responsive to spikes
- Longer: Smoother baseline
- Recommended: 20 for balance
Spike Multiplier (1.0-3.0):
- Lower: More sensitive spike detection
- Higher: Only extreme spikes
- Recommended: 1.5 for day trading
MULTI-TIMEFRAME SETTINGS:
HTF 1 (Trend):
- 5m chart: Use 15m or 1H
- 15m chart: Use 1H or 4H
- 1H chart: Use 4H or 1D
HTF 2 (Bias):
- One level higher than HTF 1
- Provides longer-term context
- Don't use same as HTF 1
EMA SETTINGS:
Length:
- 20: Responsive, more signals
- 50: Smoother, stronger filter
- 200: Long-term trend only
Style:
- Choose contrasting color
- Width 1-2 for visibility
- Match your trading style
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
BEST PRACTICES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Chart Timeframe Selection:
- ORB Trading: Use 5m or 15m charts
- Session Review: Use 1H or 4H charts
- Swing Trading: Use 1H or 4H charts
Quality Over Quantity:
- Wait for high-quality alerts (volume + MTF)
- Avoid trading every breakout
- Focus on confluence setups
Risk Management:
- Position size based on range width
- Wider ranges = smaller positions
- Use stop losses always
- Take partial profits at targets
Market Conditions:
- Best results in trending markets
- Reduce position size in choppy conditions
- Consider session overlaps for volatility
- Avoid trading near major news if inexperienced
Continuous Improvement:
- Track win rate by session
- Note which confluence factors work best
- Adjust settings based on market volatility
- Review performance weekly
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
PERFORMANCE OPTIMIZATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator is optimized with:
- max_bars_back declarations for efficient processing
- Conditional calculations based on enabled features
- Proper memory management for drawing objects
- Minimal recalculation on each bar
Best Practices:
- Disable unused features (sessions, MTF, volume)
- Limit historical display to reduce rendering
- Use appropriate timeframe for your strategy
- Clear old drawing objects periodically
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
EDUCATIONAL DISCLAIMER
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator combines established trading concepts:
- Opening Range Breakout theory (price action)
- Liquidity level detection (pivot analysis)
- Session-based trading (time-of-day patterns)
- Volume analysis (confirmation technique)
- Multi-timeframe analysis (trend alignment)
All calculations use standard technical analysis methods:
- Pivot high/low detection algorithms
- Moving averages for trend and volume
- Session time filtering
- Timeframe security functions
The indicator identifies potential trading setups but does not predict future price movements. Success requires proper application within a complete trading strategy including risk management, position sizing, and market context.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
USAGE DISCLAIMER
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This tool is for educational and analytical purposes. Opening Range Breakout trading involves substantial risk. The alert system and quality filters are designed to identify potential setups but do not guarantee profitability. Always conduct independent analysis, use proper risk management, and never risk capital you cannot afford to lose. Past performance does not indicate future results. Trading intraday breakouts requires experience and discipline.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CREDITS & ATTRIBUTION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ORIGINAL SOURCE:
This indicator builds upon concepts from LuxAlgo's-ORB
Pine Scriptยฎ indicator
SMC Analysis - Fair Value Gaps (Enhanced)SMC Analysis - Fair Value Gaps (Enhanced) Script Summary
Overview
The "SMC Analysis - Fair Value Gaps (Enhanced)" script, written in Pine Script (version 6), is a technical analysis indicator designed for TradingView to identify and visualize Fair Value Gaps (FVGs) on a price chart. It supports both the main timeframe and multiple higher timeframes (MTF) for comprehensive market analysis. FVGs are price gaps formed by a three-candle pattern, indicating potential areas of market inefficiency where price may return to fill the gap.
Key Features
FVG Detection:
Identifies bullish FVGs: Occur when the high of a candle two bars prior is lower than the low of the current candle, with the middle candle being bullish (close > open).
Identifies bearish FVGs: Occur when the low of a candle two bars prior is higher than the high of the current candle, with the middle candle being bearish (close < open).
Visualizes FVGs as colored boxes on the chart (green for bullish, red for bearish).
Mitigation Tracking:
Tracks when FVGs are touched (price overlaps the gap range) or mitigated (price fully closes the gap).
Strict Mode: Marks an FVG as mitigated when price touches the gap range.
Normal Mode: Requires a full breakthrough (price crossing the gapโs bottom for bullish FVGs or top for bearish FVGs) for mitigation.
Optionally converts FVG box borders to dashed lines and increases transparency when partially touched.
Multi-Timeframe (MTF) Support:
Analyzes FVGs on three user-defined higher timeframes (default: 15m, 60m, 240m).
Displays MTF FVGs with distinct labels and slightly more transparent colors.
Ensures no duplicate processing of MTF bars to maintain performance.
Customization Options:
FVG Length: Adjustable duration for how long FVGs are displayed (default: 20 bars).
Show/Hide FVGs: Toggle visibility for main timeframe and each MTF.
Color Customization: User-defined colors for bullish and bearish FVGs (default: green and red).
Display Options: Toggle for showing dashed lines after partial touches and strict mitigation mode.
Performance Optimization:
Limits the number of displayed boxes (50 for main timeframe, 20 per MTF) to prevent performance issues.
Automatically removes older boxes to maintain a clean chart.
Functionality
Visualization: Draws boxes around detected FVGs, with customizable colors and text labels ("FVG" for main timeframe, "FVG " for MTF).
Dynamic Updates: Extends or terminates FVG boxes based on mitigation status and user settings.
Efficient Storage: Uses arrays to manage FVG data (boxes, tops, bottoms, indices, mitigation status, and touch status) separately for main and MTF analyses.
Use Case
This indicator is designed for traders using Smart Money Concepts (SMC) to identify areas of market inefficiency (FVGs) for potential price reversals or continuations. The MTF support allows analysis across different timeframes, aiding in confirming trends or spotting higher-timeframe support/resistance zones.
Pine Scriptยฎ indicator
SuperTrend Cyan โ Split ST & Triple Bands (A/B/C)SuperTrend Cyan โ Split ST & Triple Bands (A/B/C)
โจ Concept:
The SuperTrend Cyan indicator expands the classical SuperTrend logic into a split-line + triple-band visualization for clearer structure and volatility mapping.
Instead of a single ATR-based line, this tool separates SuperTrend direction from volatility envelopes (A/B/C), providing a layered view of both regime and range compression.
โจ The design goal:
Preserve the simplicity of SuperTrend
Add volatility context via multi-band envelopes
Provide a compact MTF (Multi-Timeframe) summary for broader trend alignment
โจ How It Works
1. SuperTrend Core (Active & Opposite Lines)
Uses ATR-based bands (Factor ร ATR-Length).
Active SuperTrend is plotted according to current regime.
Opposite SuperTrend (optional) shows potential reversal threshold.
2. Triple Band System (A/B/C)
Each band (A, B, C) scales from the median price (hl2) by different ATR multipliers.
A: Outer band (wider, long-range context)
B: Inner band (mid-range activity)
C: Core band (closest to price, short-term compression)
Smoothness can be controlled with EMA.
Uptrend fills are lime-toned, downtrend fills are red-toned, with adjustable opacity (gap intensity).
3. Automatic Directional Switch
When the regime flips from up โ down (or vice versa), the overlay automatically switches between lower and upper bands for a clean transition.
4. Multi-Timeframe SuperTrend Table
Displays SuperTrend direction across 5m, 15m, 1h, 4h, and 1D frames.
Green โฒ = Uptrend, Red โผ = Downtrend.
Useful for checking cross-timeframe trend alignment.
โจ How to Read It
Green SuperTrend + Lime Bands
- Uptrend regime; volatility expanding upward
Red SuperTrend + Red Bands
- Downtrend regime; volatility expanding downward
Narrow gaps (AโC)
- Low volatility / compression (potential squeeze)
Wide gaps
- High volatility / active trend phase
Opposite ST line close to price
- Early warning for regime transition
โจ Practical Use
Identify trend direction (SuperTrend color & line position).
Assess volatility conditions (band width and gap transparency).
Watch for MTF alignment: consistent up/down signals across 1hโ4hโ1D = strong structural trend.
Combine with momentum indicators (e.g., RSI, DFI, PCI) for confirmation of trend maturity or exhaustion.
โจ Customization Tips
ST Factor / ATR Length
- Adjust sensitivity of SuperTrend direction changes
Band ATR Length
- Controls overall smoothness of volatility envelopes
Band Multipliers (A/B/C)
- Define how wide each volatility band extends
Gap Opacity
- Affects visual contrast between layers
MTF Table
- Enable/disable multi-timeframe display
โจ Educational Value
This script visualizes the interaction between trend direction (SuperTrend) and volatility envelopes, helping traders understand how price reacts within layered ATR zones.
It also introduces a clean MTF (multi-timeframe) perspective โ ideal for discretionary and system traders alike.
โจ Disclaimer
This indicator is provided for educational and research purposes only.
It does not constitute financial advice or a trading signal.
Use at your own discretion and always confirm with additional tools.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ ํ๊ตญ์ด ์ค๋ช
(Korean translation below)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โจ๊ฐ๋
SuperTrend Cyan ์งํ๋ ๊ธฐ์กด์ SuperTrend๋ฅผ ํ์ฅํ์ฌ,
์ถ์ธ์ ๋ถ๋ฆฌ(Split Line) + 3์ค ๋ฐด๋ ์์คํ
(Triple Bands) ์ผ๋ก
์์ฅ์ ๊ตฌ์กฐ์ ํ๋ฆ๊ณผ ๋ณ๋์ฑ ๋ฒ์๋ฅผ ๋์์ ์๊ฐํํฉ๋๋ค.
๋จ์ํ SuperTrend์ ๊ฐ์ ์ ์ ์งํ๋ฉด์๋,
ATR ๊ธฐ๋ฐ์ A/B/C ๋ฐด๋๋ฅผ ํตํด ๋ณ๋์ฑ ์์ถยทํ์ฅ ๊ตฌ๊ฐ์ ์ง๊ด์ ์ผ๋ก ํ์
ํ ์ ์์ต๋๋ค.
โจ ์๋ ๋ฐฉ์
1. SuperTrend ์ฝ์ด (ํ์ฑ/๋ฐ๋ ๋ผ์ธ)
ATRรFactor๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์ถ์ธ์ ์ ๊ณ์ฐํฉ๋๋ค.
ํ์ฌ ์ถ์ธ ๋ฐฉํฅ์ ๋ฐ๋ผ ํ์ฑ ๋ผ์ธ์ด ํ์๋๊ณ , โShow Oppositeโ ์ต์
์ ์ผ๋ฉด ๋ฐ๋ํธ ๊ฒฝ๊ณ์ ๋ ํจ๊ป ๋ณด์
๋๋ค.
2. ํธ๋ฆฌํ ๋ฐด๋ ์์คํ
(A/B/C)
hl2(์ค๊ฐ๊ฐ)๋ฅผ ๊ธฐ์ค์ผ๋ก ATR ๋ฐฐ์์ ๋ฐ๋ผ ์ธ ๊ฐ์ ๋ฐด๋๋ฅผ ๊ณ์ฐํฉ๋๋ค.
A: ์ธ๊ณฝ ๋ฐด๋ (๊ฐ์ฅ ๋๊ณ ์ฅ๊ธฐ ๊ตฌ์กฐ ๋ฐ์)
B: ์ค๊ฐ ๋ฐด๋ (์ค๊ธฐ์ ์์ง์)
C: ์ฝ์ด ๋ฐด๋ (๊ฐ๊ฒฉ์ ๊ฐ์ฅ ๊ทผ์ , ๋จ๊ธฐ ๋ณ๋์ฑ ๋ฐ์)
EMA ์ค๋ฌด๋ฉ์ผ๋ก ๋ถ๋๋ฝ๊ฒ ์กฐ์ ๊ฐ๋ฅ.
์
ํธ๋ ๋ ๊ตฌ๊ฐ์ ๋ผ์์, ๋ค์ดํธ๋ ๋๋ ๋นจ๊ฐ์ ์์์ผ๋ก ํ์๋ฉ๋๋ค.
3. ์๋ ์ ํ ์์คํ
์ถ์ธ๊ฐ ์ ํ๋ ๋(Up โ Down), ๋ฐด๋ ์ค๋ฒ๋ ์ด๋ ์๋์ผ๋ก ๊ต์ฒด๋์ด ๊น๋ํ ์๊ฐ์ ๊ตฌ์กฐ๋ฅผ ์ ์งํฉ๋๋ค.
4. MTF SuperTrend ํ
์ด๋ธ
5m / 15m / 1h / 4h / 1D ํ๋ ์๋ณ SuperTrend ๋ฐฉํฅ์ ํ์ํฉ๋๋ค.
์ด๋ก โฒ = ์์น, ๋นจ๊ฐ โผ = ํ๋ฝ.
๋ณต์ ํ์ํ๋ ์ ์ ๋ ฌ ํ์ธ์ฉ์ผ๋ก ์ ์ฉํฉ๋๋ค.
โจ ํด์ ๋ฐฉ๋ฒ
์ด๋ก SuperTrend + ๋ผ์ ๋ฐด๋
- ์์น ์ถ์ธ ๋ฐ ํ์ฅ ๊ตฌ๊ฐ
๋นจ๊ฐ SuperTrend + ๋ ๋ ๋ฐด๋
- ํ๋ฝ ์ถ์ธ ๋ฐ ํ์ฅ ๊ตฌ๊ฐ
๋ฐด๋ ํญ์ด ์ข์
- ๋ณ๋์ฑ ์ถ์ (์คํด์ฆ)
๋ฐด๋ ํญ์ด ๋์
- ๋ณ๋์ฑ ํ์ฅ, ์ถ์ธ ๊ฐํ
๋ฐ๋์ ์ด ๊ทผ์
- ์ถ์ธ ์ ํ ๊ฐ๋ฅ์ฑ ๋์
โจ ํ์ฉ ๋ฐฉ๋ฒ
SuperTrend ์์์ผ๋ก ์ถ์ธ ๋ฐฉํฅ์ ํ์ธ
A/B/C ๋ฐด๋ ํญ์ผ๋ก ๋ณ๋์ฑ ์์ค์ ํ๋จ
MTF ํ
์ด๋ธ์ ํตํด ๋ณต์ ํ์ํ๋ ์ ์ ๋ ฌ ์ฌ๋ถ ํ์ธ
RSI, DFI, PCI ๋ฑ ๋ค๋ฅธ ์งํ์ ํจ๊ป ํ์ฉ ์, ์ถ์ธ ํผ๋กยท๋ชจ๋ฉํ
๋ณํ๋ฅผ ์กฐ๊ธฐ์ ํ์
๊ฐ๋ฅ
โจ ๊ต์ก์ ๊ฐ์น
์ด ์คํฌ๋ฆฝํธ๋ ์ถ์ธ ๊ตฌ์กฐ(SuperTrend) ์ ๋ณ๋์ฑ ๋ ์ด์ด(ATR Bands) ์ ์ํธ์์ฉ์
์๊ฐ์ ์ผ๋ก ํ์ตํ๊ธฐ ์ํ ๊ต์ก์ฉ ์งํ์
๋๋ค.
๋ํ, MTF ๊ตฌ์กฐ๋ฅผ ํตํด ์์ฅ์ โ์๊ณ์ ์ ๋ ฌ(hierarchical alignment)โ์ ์ฝ๊ฒ ์ธ์ํ ์ ์์ต๋๋ค.
โจ ๋ฉด์ฑ
์ด ์งํ๋ ๊ต์ก ๋ฐ ์ฐ๊ตฌ ๋ชฉ์ ์ผ๋ก๋ง ์ ๊ณต๋ฉ๋๋ค.
ํฌ์ ํ๋จ์ ์ฑ
์์ ์ฌ์ฉ์ ๋ณธ์ธ์๊ฒ ์์ผ๋ฉฐ, ๋ณธ ์งํ๋ ๋งค๋งค ์ ํธ๋ฅผ ๋ณด์ฅํ์ง ์์ต๋๋ค.
Pine Scriptยฎ indicator
Extreme Pressure Zones Indicator (EPZ) [BullByte]Extreme Pressure Zones Indicator(EPZ)
The Extreme Pressure Zones (EPZ) Indicator is a proprietary market analysis tool designed to highlight potential overbought and oversold "pressure zones" in any financial chart. It does this by combining several unique measurements of price action and volume into a single, bounded oscillator (0โ100). Unlike simple momentum or volatility indicators, EPZ captures multiple facets of market pressure: price rejection, trend momentum, supply/demand imbalance, and institutional (smart money) flow. This is not a random mashup of generic indicators; each component was chosen and weighted to reveal extreme market conditions that often precede reversals or strong continuations.
What it is?
EPZ estimates buying/selling pressure and highlights potential extreme zones with a single, bounded 0โ100 oscillator built from four normalized components. Context-aware weighting adapts to volatility, trendiness, and relative volume. Visual tools include adaptive thresholds, confirmed-on-close extremes, divergence, an MTF dashboard, and optional gradient candles.
Purpose and originality (not a mashup)
Purpose: Identify when pressure is building or reaching potential extremes while filtering noise across regimes and symbols.
Originality: EPZ integrates price rejection, momentum cascade, pressure distribution, and smart money flow into one bounded scale with context-aware weighting. It is not a cosmetic mashup of public indicators.
Why a trader might use EPZ
EPZ provides a multi-dimensional gauge of market extremes that standalone indicators may miss. Traders might use it to:
Spot Reversals: When EPZ enters an "Extreme High" zone (high red), it implies selling pressure might soon dominate. This can hint at a topside reversal or at least a pause in rallies. Conversely, "Extreme Low" (green) can highlight bottom-fish opportunities. The indicator's divergence module (optional) also finds hidden bullish/bearish divergences between price and EPZ, a clue that price momentum is weakening.
Measure Momentum Shifts: Because EPZ blends momentum and volume, it reacts faster than many single metrics. A rising MPO indicates building bullish pressure, while a falling MPO shows increasing bearish pressure. Traders can use this like a refined RSI: above 50 means bullish bias, below 50 means bearish bias, but with context provided by the thresholds.
Filter Trades: In trend-following systems, one could require EPZ to be in the bullish (green) zone before taking longs, or avoid new trades when EPZ is extreme. In mean-reversion systems, one might specifically look to fade extremes flagged by EPZ.
Multi-Timeframe Confirmation: The dashboard can fetch a higher timeframe EPZ value. For example, you might trade a 15-minute chart only when the 60-minute EPZ agrees on pressure direction.
Components and how they're combined
Rejection (PRV) โ Captures price rejection based on candle wicks and volume (see Price Rejection Volume).
Momentum Cascade (MCD) โ Blends multiple momentum periods (3,5,8,13) into a normalized momentum score.
Pressure Distribution (PDI) โ Measures net buy/sell pressure by comparing volume on up vs down candles.
Smart Money Flow (SMF) โ An adaptation of money flow index that emphasizes unusual volume spikes.
Each of these components produces a 0โ100 value (higher means more bullish pressure). They are then weighted and averaged into the final Market Pressure Oscillator (MPO), which is smoothed and scaled. By combining these four views, EPZ stands out as a comprehensive pressure gauge โ the whole is greater than the sum of parts
Context-aware weighting:
Higher volatility โ more PRV weight
Trendiness up (RSI of ATR > 25) โ more MCD weight
Relative volume > 1.2x โ more PDI weight
SMF holds a stable weight
The weighted average is smoothed and scaled into MPO โ with 50 as the neutral midline.
What makes EPZ stand out
Four orthogonal inputs (price action, momentum, pressure, flow) unified in a single bounded oscillator with consistent thresholds.
Adaptive thresholds (optional) plus robust extreme detection that also triggers on crossovers, so static thresholds work reliably too.
Confirm Extremes on Bar Close (default ON): dots/arrows/labels/alerts print on closed bars to avoid repaint confusion.
Clean dashboard, divergence tools, pre-alerts, and optional on-price gradients. Visual 3D layering uses offsets for depth only,no lookahead.
Recommended markets and timeframes
Best: liquid symbols (index futures, large-cap equities, major FX, BTC/ETH).
Timeframes: 5โ15m (more signals; consider higher thresholds), 1Hโ4H (balanced), 1D (clear regimes).
Use caution on illiquid or very low TFs where wick/volume geometry is erratic.
Logic and thresholds
MPO โ ; 50 = neutral. Above 50 = bullish pressure; below 50 = bearish.
Static thresholds (defaults): thrHigh = 70, thrLow = 30; warning bands 5 pts inside extremes (65/35).
Adaptive thresholds (optional):
thrHigh = min(BaseHigh + 5, mean(MPO,100) + stdev(MPO,100) ร ExtremeSensitivity)
thrLow = max(BaseLow โ 5, mean(MPO,100) โ stdev(MPO,100) ร ExtremeSensitivity)
Extreme detection
High: MPO โฅ thrHigh with peak/slope or crossover filter.
Low: MPO โค thrLow with trough/slope or crossover filter.
Cooldown: 5 bars (default). A new extreme will not print until the cooldown elapses, even if MPO re-enters the zone.
Confirmation
"Confirm Extremes on Bar Close" (default ON) gates extreme markers, pre-alerts, and alerts to closed bars (non-repainting).
Divergences
Pivot-based bullish/bearish divergence; tags appear only after left/right bars elapse (lookbackPivot).
MTF
HTF MPO retrieved with lookahead_off; values can update intrabar and finalize at HTF close. This is disclosed and expected.
Inputs and defaults (key ones)
Core: Sensitivity=1.0; Analysis Period=14; Smoothing=3; Adaptive Thresholds=OFF.
Extremes: Base High=70, Base Low=30; Extreme Sensitivity=1.5; Confirm Extremes on Bar Close=ON; Cooldown=5; Dot size Small/Tiny.
Visuals: Heatmap ON; 3D depth optional; Strength bars ON; Pre-alerts OFF; Divergences ON with tags ON; Gradient candles OFF; Glow ON.
Dashboard: ON; Position=Top Right; Size=Normal; MTF ON; HTF=60m; compact overlay table on price chart.
Advanced caps: Max Oscillator Labels=80; Max Extreme Guide Lines=80; Divergence objects=60.
Dashboard: what each element means
Header: EPZ ANALYSIS.
Large readout: Current MPO; color reflects state (extreme, approaching, or neutral).
Status badge: "Extreme High/Low", "Approaching High/Low", "Bullish/Neutral/Bearish".
HTF cell (when MTF ON): Higher-timeframe MPO, color-coded vs extremes; updates intrabar, settles at HTF close.
Predicted (when MTF OFF): Simple MPO extrapolation using momentum/accelerationโillustrative only.
Thresholds: Current thrHigh/thrLow (static or adaptive).
Components: ASCII bars + values for PRV, MCD, PDI, SMF.
Market metrics: Volume Ratio (x) and ATR% of price.
Strength: Bar indicator of |MPO โ 50| ร 2.
Confidence: Heuristic gauge (100 in extremes, 70 in warnings, 50 with divergence, else |MPO โ 50|). Convenience only, not probability.
How to read the oscillator
MPO Value (0โ100): A reading of 50 is neutral. Values above ~55 are increasingly bullish (green), while below ~45 are increasingly bearish (red). Think of these as "market pressure".
Extreme Zones: When MPO climbs into the bright orange/red area (above the base-high line, default 70), the chart will display a dot and downward arrow marking that extreme. Traders often treat this as a sign to tighten stops or look for shorts. Similarly, a bright green dot/up-arrow appears when MPO falls below the base-low (30), hinting at a bullish setup.
Heatmap/Candles: If "Pressure Heatmap" is enabled, the background of the oscillator pane will fade green or red depending on MPO. Users can optionally color the price candles by MPO value (gradient candles) to see these extremes on the main chart.
Prediction Zone(optional): A dashed projection line extends the MPO forward by a small number of bars (prediction_bars) using current MPO momentum and acceleration. This is a heuristic extrapolation best used for short horizons (1โ5 bars) to anticipate whether MPO may touch a warning or extreme zone. It is provisional and becomes less reliable with longer projection lengths โ always confirm predicted moves with bar-close MPO and HTF context before acting.
Divergences: When price makes a higher high but EPZ makes a lower high (bearish divergence), the indicator can draw dotted lines and a "Bear Div" tag. The opposite (lower low price, higher EPZ) gives "Bull Div". These signals confirm waning momentum at extremes.
Zones: Warning bands near extremes; Extreme zones beyond thresholds.
Crossovers: MPO rising through 35 suggests easing downside pressure; falling through 65 suggests waning upside pressure.
Dots/arrows: Extreme markers appear on closed bars when confirmation is ON and respect the 5-bar cooldown.
Pre-alert dots (optional): Proximity cues in warning zones; also gated to bar close when confirmation is ON.
Histogram: Distance from neutral (50); highlights strengthening or weakening pressure.
Divergence tags: "Bear Div" = higher price high with lower MPO high; "Bull Div" = lower price low with higher MPO low.
Pressure Heatmap : Layered gradient background that visually highlights pressure strength across the MPO scale; adjustable intensity and optional zone overlays (warning / extreme) for quick visual scanning.
A typical reading: If the oscillator is rising from neutral towards the high zone (greenโorangeโred), the chart may see strong buying culminating in a stall. If it then turns down from the extreme, that peak EPZ dot signals sell pressure.
Alerts
EPZ: Extreme Context โ fires on confirmed extremes (respects cooldown).
EPZ: Approaching Threshold โ fires in warning zones if no extreme.
EPZ: Divergence โ fires on confirmed pivot divergences.
Tip: Set alerts to "Once per bar close" to align with confirmation and avoid intrabar repaint.
Practical usage ideas
Trend continuation: In positive regimes (MPO > 50 and rising), pullbacks holding above 50 often precede continuation; mirror for bearish regimes.
Exhaustion caution: E High/E Low can mark exhaustion risk; many wait for MPO rollover or divergence to time fades or partial exits.
Adaptive thresholds: Useful on assets with shifting volatility regimes to maintain meaningful "extreme" levels.
MTF alignment: Prefer setups that agree with the HTF MPO to reduce countertrend noise.
Examples
Screenshots captured in TradingView Replay to freeze the bar at close so values don't fluctuate intrabar. These examples use default settings and are reproducible on the same bars; they are for illustration, not cherry-picking or performance claims.
Example 1 โ BTCUSDT, 1h โ E Low
MPO closed at 26.6 (below the 30 extreme), printing a confirmed E Low. HTF MPO is 26.6, so higher-timeframe pressure remains bearish. Components are subdued (Momentum/Pressure/Smart$ โ 29โ37), with Vol Ratio โ 1.19x and ATR% โ 0.37%. A prior Bear Div flagged weakening impulse into the drop. With cooldown set to 5 bars, new extremes are rate-limited. Many traders wait for MPO to curl up and reclaim 35 or for a fresh Bull Div before considering countertrend ideas; if MPO cannot reclaim 35 and HTF stays weak, treat bounces cautiously. Educational illustration only.
Example 2 โ ETHUSD, 30m โ E High
A strong impulse pushed MPO into the extreme zone (โฅ 70), printing a confirmed E High on close. Shortly after, MPO cooled to ~61.5 while a Bear Div appeared, showing momentum lag as price pushed a higher high. Volume and volatility were elevated (โ 1.79x / 1.25%). With a 5-bar cooldown, additional extremes won't print immediately. Some treat E High as exhaustion riskโeither waiting for MPO rollover under 65/50 to fade, or for a pullback that holds above 50 to re-join the trend if higher-timeframe pressure remains constructive. Educational illustration only.
Known limitations and caveats
The MPO line itself can change intrabar; extreme markers/alerts do not repaint when "Confirm Extremes on Bar Close" is ON.
HTF values settle at the close of the HTF bar.
Illiquid symbols or very low TFs can be noisy; consider higher thresholds or longer smoothing.
Prediction line (when enabled) is a visual extrapolation only.
For coders
Pine v6. MTF via request.security with lookahead_off.
Extremes include crossover triggers so static thresholds also yield E High/E Low.
Extreme markers and pre-alerts are gated by barstate.isconfirmed when confirmation is ON.
Arrays prune oldest objects to respect resource limits; defaults (80/80/60) are conservative for low TFs.
3D layering uses negative offsets purely for drawing depth (no lookahead).
Screenshot methodology:
To make labels legible and to demonstrate non-repainting behavior, the examples were captured in TradingView Replay with "Confirm Extremes on Bar Close" enabled. Replay is used only to freeze the bar at close so plots don't change intrabar. The examples use default settings, include both Extreme Low and Extreme High cases, and can be reproduced by scrolling to the same bars outside Replay. This is an educational illustration, not a performance claim.
Disclaimer
This script is for educational purposes only and does not constitute financial advice. Markets involve risk; past behavior does not guarantee future results. You are responsible for your own testing, risk management, and decisions.
Pine Scriptยฎ indicator
DynamoSent DynamoSent Pro+ โ Professional Listing (Preview)
โ Adaptive Macro Sentiment (v6)
โ Export, Adaptive Lookback, Confidence, Boxes, Heatmap + Dynamic OB/OS
Preview / Experimental build. Iโm actively refining this toolโyour feedback is gold.
If you spot edge cases, want new presets, or have market-specific ideas, please comment or DM me on TradingView.
โธป
What it is
DynamoSent Pro+ is an adaptive, non-repainting macro sentiment engine that compresses VIX, DXY and a price-based activity proxy (e.g., SPX/sector ETF/your symbol) into a 0โ100 sentiment line. It scales context by volatility (ATR%) and can self-calibrate with rolling quantile OB/OS. On top of that, it adds confidence scoring, a plain-English Context Coach, MTF agreement, exportable sentiment for other indicators, and a clean Light/Dark UI.
Why itโs different
โข Adaptive lookback tracks regime changes: when volatility rises, we lengthen context; when it falls, we shortenโless whipsaw, more relevance.
โข Dynamic OB/OS (quantiles) self-calibrates to each instrumentโs distributionโno arbitrary 30/70 lines.
โข MTF agreement + Confidence gate reduce false positives by highlighting alignment across timeframes.
โข Exportable output: hidden plot โDynamoSent Exportโ can be selected as input.source in your other Pine scripts.
โข Non-repainting rigor: all request.security() calls use lookahead_off + gaps_on; signals wait for bar close.
Key visuals
โข Sentiment line (0โ100), OB/OS zones (static or dynamic), optional TF1/TF2 overlays.
โข Regime boxes (Overbought / Oversold / Neutral) that update live without repaint.
โข Info Panel with confidence heat, regime, trend arrow, MTF readout, and Coach sentence.
โข Session heat (Asia/EU/US) to match intraday behavior.
โข Light/Dark theme switch in Inputs (auto-contrasted labels & headers).
โธป
How to use (examples & recipes)
1) EURUSD (swing / intraday blend)
โข Preset: EURUSD 1H Swing
โข Chart: 1H; TF1=1H, TF2=4H (default).
โข Proxies: Defaults work (VIX=D, DXY=60, Proxy=D).
โข Dynamic OB/OS: ON at 20/80; Confidence โฅ 55โ60.
โข Playbook:
โข When sentiment crosses above 50 + margin with ฮ โฅ signalK and MTF agreement โฅ 0.5, treat as trend breakout.
โข In Oversold with rising Coach & TF agreement, take fade longs back toward mid-range.
โข Alerts: Enable Breakout Long/Short and Fade; keep cooldown 8โ12 bars.
2) SPY (daytrading)
โข Preset: SPY 15m Daytrade; Chart: 15m.
โข VIX (D) matters more; preset weights already favor it.
โข Start with static 30/70; later try dynamic 25/75 for adaptive thresholds.
โข Use Coach: in US session, when it says โOverbought + MTF agree โ sell rallies / chase breakoutsโ, lean momentum-continuation after pullbacks.
3) BTCUSD (crypto, 24/7)
โข Preset: BTCUSD 1H; Chart: 1H.
โข DXY and BTC.D inform macro tone; keep Carry-forward ON to bridge sparse ticks.
โข Prefer Dynamic OB/OS (15/85) for wider swings.
โข Fade signals on weekend chop; Breakout when Confidence > 60 and MTF โฅ 1.0.
4) XAUUSD (gold, macro blend)
โข Preset: XAUUSD 4H; Chart: 4H.
โข Weights tilt to DXY and US10Y (handled by preset).
โข Coach + MTF helps separate trend legs from news pops.
โธป
Best practices
โข Theme: Switch Light/Dark in Inputs; the panel adapts contrast automatically.
โข Export: In another script โ Source โ DynamoSent Pro+ โ DynamoSent Export. Build your own filters/strategies atop the same sentiment.
โข Dynamic vs Static OB/OS:
โข Static 30/70: fast, universal baseline.
โข Dynamic (quantiles): instrument-aware; use 20/80 (default) or 15/85 for choppy markets.
โข Confidence gate: Start at 50โ60% to filter noise; raise when you want only A-grade setups.
โข Adaptive Lookback: Keep ON. For ultra-liquid indices, you can switch it OFF and set a fixed lookback.
โธป
Non-repainting & safety notes
โข All request.security() calls use lookahead=barmerge.lookahead_off and gaps=barmerge.gaps_on.
โข No forward references; signals & regime flips are confirmed on bar close.
โข History-dependent funcs (ta.change, ta.percentile_linear_interpolation, etc.) are computed each bar (not conditionally).
โข Adaptive lookback is clamped โฅ 1 to avoid lowest/highest errors.
โข Missing-data warning triggers only when all proxies are NA for a streak; carry-forward can bridge small gaps without repaint.
โธป
Known limits & tips
โข If a proxy symbol isnโt available on your plan/exchange, youโll see the NA warning: choose a different symbol via Symbol Search, or keep Carry-forward ON (it defaults to neutral where needed).
โข Intraday VIX is sparseโusing Daily is intentional.
โข Dynamic OB/OS needs enough history (see dynLenFloor). On short histories it gracefully falls back to static levels.
Thanks for trying the preview. Your comments drive the roadmapโpresets, new proxies, extra alerts, and integrations.
Pine Scriptยฎ indicator






















