Sweep + MSS# Sweep + MSS Indicator
This indicator identifies market sweeps and Market Structure Shifts (MSS) to help traders recognize potential trend changes and market manipulations.
How it works:
1. Sweep Detection:
- Identifies when price briefly moves beyond a recent high/low (pivot point) and then reverses.
- Bullish sweep: Price drops below a recent low, then closes above it.
- Bearish sweep: Price rises above a recent high, then closes below it.
2. Market Structure Shift (MSS):
- Occurs when price action invalidates a previous sweep level.
- Bullish MSS: Price closes above a bearish sweep level.
- Bearish MSS: Price closes below a bullish sweep level.
Key Features:
- Customizable pivot lookback length for sweep detection
- Minimum bar requirement after a sweep before MSS can trigger
- One MSS per sweep level to avoid multiple signals
- Visual representation with lines connecting sweep points to MSS triggers
- Emoji labels for easy identification (🐂-MSS for bullish, 🐻-MSS for bearish)
Logic Behind MSS:
The MSS aims to identify potential trend changes by recognizing when the market invalidates a previous sweep level. This often indicates a shift in market structure, suggesting that the previous trend may be weakening or reversing.
- A bullish MSS occurs when the price closes above a bearish sweep level, potentially signaling a shift from bearish to bullish sentiment.
- A bearish MSS occurs when the price closes below a bullish sweep level, potentially signaling a shift from bullish to bearish sentiment.
By requiring a minimum number of bars between the sweep and the MSS, the indicator helps filter out noise and focuses on more significant structural changes in the market.
This indicator can be a valuable tool for traders looking to identify potential trend changes and entry/exit points based on market structure analysis.
Индикаторы и стратегии
UtilityLibrary "Utility"
A utility library for various trading tools such as signal generation, custom indicators, and multi-condition crossovers.
multiCrossover(source1, source2, threshold1, threshold2)
multiCrossover
@description Detects multi-condition crossovers between two sources with threshold filters.
Parameters:
source1 (float) : The first data series to compare.
source2 (float) : The second data series to compare.
threshold1 (float) : A value that source1 must exceed to trigger the crossover.
threshold2 (float) : A value that source2 must exceed to trigger the crossunder.
Returns: A tuple: (crossUp, crossDown) where crossUp is a boolean for upward crossover, and crossDown is for downward crossover.
macdCustom(source, fastLength, slowLength, signalLength, macdThresh)
macdCustom
@description Calculates custom MACD signals based on thresholds.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA.
slowLength (simple int) : The length of the slow EMA.
signalLength (simple int) : The signal line length.
macdThresh (float) : A threshold for the MACD line to confirm buy/sell signals.
Returns: A tuple: (macdBuySignal, macdSellSignal) where macdBuySignal is true when MACD crosses above, and macdSellSignal is true when MACD crosses below the signal line.
combinedMacdRsi(source, fastLength, slowLength, signalLength, rsiLength, macdThresh, rsiThresh)
combinedMacdRsi
@description Generates combined signals from MACD and RSI indicators.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA for MACD.
slowLength (simple int) : The length of the slow EMA for MACD.
signalLength (simple int) : The signal line length for MACD.
rsiLength (simple int) : The length of the RSI calculation.
macdThresh (float) : The threshold for MACD signals.
rsiThresh (float) : The threshold for RSI signals.
Returns: A tuple: (buySignal, sellSignal) where buySignal is generated when MACD is positive and RSI is below the threshold, and sellSignal when MACD is negative and RSI is above the threshold.
movingAverageCrossover(source, shortLength, longLength)
movingAverageCrossover
@description Detects crossovers between short-term and long-term moving averages.
Parameters:
source (float) : The price data or input series.
shortLength (int) : The length of the short-term moving average.
longLength (int) : The length of the long-term moving average.
Returns: A tuple: (crossUp, crossDown) where crossUp is true when the short-term MA crosses above the long-term MA, and crossDown when the reverse occurs.
BTC ETF Flow Trading SignalsTracks large money flows (500M+) across major Bitcoin ETFs (IBIT, BTCO, FBTC, ARKB, BITB)
Generates long/short signals based on institutional money movement
Shows flow trends and strength of movements
This script provides a foundation for comparing ETF inflows and Bitcoin price. The effectiveness of the analysis depends on the quality of the data and your interpretation of the results. Key levels of 500M and 350M Inflow/Outflow Enjoy
Collaboration with Vivid Vibrations
Enjoy & improve!
Highest Single-Day Percentage Change (Close to Close)This Pine Script is designed to calculate and display the largest percentage change in stock price between consecutive days' closing prices. Here's a high-level breakdown of what the script does:
Daily Percentage Change Calculation:
It calculates how much the stock price changed from the previous day's close to the current day's close. The change is expressed as a percentage of the previous day's closing price.
Tracking the Highest Change:
The script keeps track of the largest percentage increase or decrease it has encountered in the dataset (from previous close to current close). It updates the value if a new day exceeds the current largest recorded percentage change.
Visual Representation:
The daily percentage changes are plotted as a line graph, allowing you to see how the stock's price fluctuates from one day to the next.
A separate line is drawn to represent the highest percentage change detected so far.
If a day's price change matches the highest recorded change, a label appears on the chart to highlight that specific point.
Dynamic Updates:
The script is dynamic, meaning it continually updates as new data comes in. So, as new days are added to the chart, the script checks if the percentage change exceeds the previously highest recorded value.
Why This Is Useful:
For traders and investors: It provides a quick way to identify which day saw the most significant price movement, helping to spot major market events or volatility.
For historical analysis: You can quickly find the most extreme single-day price swings in a stock's historical data, which might be useful for understanding past market behavior or making predictions about future moves.
Saturn Retrograde PeriodsSaturn Retrograde Periods Visualizer for TradingView
This Pine Script visualizes all Saturn retrograde periods since 2009, including the current retrograde ending on November 15, 2024. The script overlays yellow boxes on your TradingView chart to highlight the exact periods of Saturn retrograde. It's a great tool for astrologically-inclined traders or those interested in market timing based on astrological events.
Key Features:
Full Historical Coverage: Displays Saturn retrograde periods from 2009 (the inception of Bitcoin) to the current retrograde ending in November 2024.
Customizable Appearance: You can easily adjust the color and opacity of the boxes directly from the script's settings window, making it flexible for various chart styles.
Visual Clarity: The boxes span the full vertical range of your chart, ensuring the retrograde periods are clearly visible over any asset, timeframe, or price action.
How to Use:
Add the script to your TradingView chart.
Adjust the color and opacity in the settings to suit your preferences.
View all relevant Saturn retrograde periods and analyze how these astrological events may align with price movements in your selected asset.
This script is perfect for traders and analysts who want to combine astrology with financial market analysis!
scripted by chat.gpt - version 1.0
[EmreKb] Combined CandlesThis script combines multiple candlestick patterns into a single, unified candle when they are of the same type (bullish or bearish). Instead of displaying every individual candle on the chart, it merges consecutive candles based on their direction to simplify the visual analysis of price movements.
What It Does:
Combines Candles: If two or more consecutive candles are bullish (close price higher than open price) or bearish (close price lower than open price), the script merges them into a single candle, adjusting the high, low, and close values accordingly.
Displays Merged Candles: The merged candles are drawn on the chart. A green bar represents a bullish period, while a red bar represents a bearish period.
How It Works:
The script tracks whether each candle is bullish or bearish.
If a candle is the same type as the previous one, it updates the combined candle (adjusting the high, low, and close values).
When the type changes (from bullish to bearish or vice versa), it finalizes the current combined candle and starts a new one.
The merged candles are displayed on the chart at the end of the data series.
Use Case:
This script simplifies price action by grouping similar candles together, making it easier to identify trends and spot periods of sustained buying or selling pressure. It can help traders focus on the overall direction of the market rather than being distracted by small fluctuations between individual candles.
Wave Anchor IndicatorThe Wave Anchor Indicator is designed to mark the crossing of overbought and oversold levels of higher time frame momentum waves, based on the VuManChu Cipher B+Divergences Wave Trend Indicator. This tool is inspired by the TP Mint trading strategy, which relies heavily on the momentum waves of Market Cipher B or VuManChu Cipher B for identifying optimal entry and exit points.
Key Concept: Anchored Waves
In the TP Mint strategy, momentum waves in overbought (above 60) or oversold (below -60) conditions on higher time frames are considered "anchored." These anchored waves provide strong signals for entries and take-profit points when viewed on lower time frames. The Wave Anchor Indicator focuses on these anchor conditions to help traders make informed decisions by seeing higher time frame anchor states directly on the entry time frame chart.
How It Works
Labeling Signals:
- On lower time frames, such as the 15-minute chart, the indicator shows labels when higher
time frame momentum waves (1-hour and 4-hour) cross the overbought or oversold levels.
- Labels above price indicate overbought conditions, with green labels when the wave crosses
upward and red labels when crossing downward.
- Labels below price signal oversold conditions, with red for a downward cross and green for an
upward cross.
- Each label displays the time frame of the crossing momentum wave, providing context for
traders at a glance.
Time Frame Pairings:
- On the 15-minute time frame, the indicator tracks anchor conditions from the 1-hour and 4-
hour time frames.
- On the 1-hour chart, it monitors 4-hour and daily time frame anchor conditions.
Customization and Alerts
Flexible Display Options : Users can choose to display none, one, or both of the grouped higher time frame labels, depending on their strategy and preferences.
Alerts : The indicator also allows for custom alerts when a label appears, helping traders stay on top of key market movements without constantly monitoring the chart.
Use Cases
This indicator is ideal for traders who use momentum-based strategies across multiple time frames. It simplifies the process of identifying key entry and exit points by focusing on the anchor conditions from higher time frames, making it easier to execute the TP Mint strategy or similar methods.
Thank you to VuManChu and LazyBear for mamking the momentum wave code open source and allowing it’s use in this indicator.
Time Vertical LinesVLines - Time-Based Vertical Lines with Zones
This PineScript indicator creates vertical time lines with customizable zones between them. Perfect for marking trading sessions, key market times, or any time-based analysis.
Key Features:
- 5 configurable time lines
- 3 customizable zones (between lines 1-2, 2-3, and 4-5)
- Each zone features:
- Background shading
- Horizontal lines at high/low points
- Independent color controls
- Adjustable line styles and widths
- Time zone offset adjustment
- Option to show/hide historical lines
Installation Instructions:
1. Open TradingView's Pine Script Editor
2. Create a new script
3. Copy and paste the entire code
4. Add to Chart
Setup Guide:
1. Time Zone Adjustment:
- Find the "Time Zone Offset (Hours)" setting
- Adjust if lines appear at wrong times
- Example: If lines appear 3 hours early, set offset to 3
2. Basic Time Lines (1-3):
- Each line has settings for:
- Hour (0-23)
- Minute (0-59)
- Color
- Show/Hide toggle
3. Session Lines (4-5):
- Special lines typically used for session marking
- Same settings as basic lines
- Default red color to distinguish from other lines
4. Zone Customization:
Three separate zones are available:
- Zone 1-2 (between first and second lines)
- Zone 2-3 (between second and third lines)
- Zone 4-5 (between fourth and fifth lines)
Each zone can be customized with:
- Background color and transparency
- Horizontal line color
- Line style (Solid/Dashed/Dotted)
- Line width
- Individual show/hide toggles for zone and lines
5. Additional Settings:
- "Show Historical Lines" - toggle to show/hide lines on previous days
- Global line style and width settings for vertical lines
Suggested Uses:
1. Mark pre-market, market, and post-market sessions
2. Highlight specific trading windows
3. Track time-based support/resistance levels
4. Monitor price ranges during specific time periods
Tips:
- Start by setting just one zone to get familiar with the controls
- Use different colors for different sessions/time periods
- Adjust transparency to maintain chart visibility
- Use the show/hide toggles to focus on specific times
- The horizontal lines automatically mark the high/low range between time points
Daily Volume Metrics BoxDaily Volume Metrics Box
A powerful tool for monitoring intraday trading metrics in real-time. This indicator provides a clean, customizable display of key market statistics that reset daily.
🔑 Key Features:
- Daily Volume Distribution - Track positive and negative volume separately
- Net Volume Analysis - Monitor the balance of buying vs selling volume
- Average Candle Size - Dynamic calculation of recent price movement magnitude
- Flexible Positioning - Place the metrics box in any corner of your chart
- Auto-Reset - All metrics automatically reset at the start of each trading day
- Current Date Display - Always know which day's data you're viewing
📊 Metrics Explained:
1. Avg Size: Average candle size over your specified lookback period
2. Pos Vol: Accumulated volume from up-moves during the current day
3. Neg Vol: Accumulated volume from down-moves during the current day
4. Net Vol: The difference between positive and negative volume (Pos Vol - Neg Vol)
⚙️ Customization Options:
- Number of candles for average (1-∞)
- Background color and transparency
- Text color
- Box position (Top/Bottom, Left/Right)
- Distance from chart edge (1-5 bars)
📌 Usage Tips:
- Use larger lookback periods for more stable average candle size
- Position the box where it won't interfere with your chart analysis
- Monitor net volume for potential trend strength confirmation
- Compare positive and negative volume for insight into price momentum
🔄 Daily Reset:
All volume metrics reset at the start of each trading day, ensuring you're always looking at current day data only.
Perfect for day traders, swing traders, and anyone who wants to monitor intraday market dynamics with clean, organized metrics.
Note: This indicator works best on intraday timeframes where volume data is available.
Fluid Dynamics-Inspired Indicator with Bidirectional ScalingThe "Enhanced Fluid Dynamics-Inspired Indicator with Bidirectional Scaling" is a sophisticated technical analysis tool that draws inspiration from the principles of fluid dynamics to measure both upward and downward price movements, while also incorporating volatility and momentum into its calculations. The indicator aims to provide traders with a clear understanding of market dynamics by analyzing "streamflow" (price and volume movements) in both directions, enhanced with adaptive scaling techniques.
Key Features:
Bidirectional Price Momentum:
The indicator separately calculates positive and negative momentum using the price's rate of change. This allows for independent analysis of upward and downward price movements, providing a balanced view of the market's direction.
Streamflow Model:
The "streamflow" is calculated by multiplying volume flow with price momentum. This approach treats the market as a fluid system, where the momentum and volume of trades influence the flow of prices in both upward and downward directions. Streamflow is calculated independently for each direction.
Adaptive Volatility Scaling:
Volatility is dynamically calculated using the Average True Range (ATR) and is weighted to adjust to varying market conditions. An adaptive logarithmic scaling factor is applied to the volatility to capture the dynamic nature of market environments.
DRMA (Displaced Rolling Moving Average):
The indicator uses the DRMA function to smooth out price and volume data, improving the accuracy of its measurements. This allows the indicator to capture longer-term trends while still being responsive to short-term fluctuations.
Non-Linear Scaling and Normalization:
To ensure that the output values are within a usable range, the indicator employs a sigmoid-based non-linear scaling function. This helps normalize the composite output, making it easier to interpret overbought and oversold conditions.
Visual Representation:
The indicator plots two separate lines for upward and downward market movements, making it easy to distinguish between bullish and bearish trends. Background colors are also used to highlight periods of strong upward or downward momentum, as well as high volatility.
Overbought/Oversold Conditions:
Upper and lower thresholds are used to signal potential overbought and oversold conditions. Alerts are triggered when the market moves into extreme levels, helping traders identify potential entry and exit points.
Usage:
This indicator is designed for traders who are looking for a more nuanced and dynamic tool to measure both bullish and bearish trends. By using bidirectional scaling, it provides clearer signals for market direction, while adaptive volatility and momentum adjustments ensure the indicator responds to different market environments. The alert conditions make it especially useful for timing trades in highly volatile conditions or when price movements reach extreme levels.
Fractal & Entropy Market Dynamics with Mexican Hat WaveletThis indicator combines fractal analysis, entropy, and wavelet theory to model market dynamics using a customized approach. It integrates advanced mathematical techniques to assess the complexity and structure of price action, while also incorporating volume and price volatility.
Key Concepts and Features:
Volume-Weighted Price:
The script calculates a volume-adjusted price using a moving average of volume to give more weight to periods with higher volume. This allows the indicator to account for the impact of trading volume on price movements, enhancing its sensitivity to significant price shifts.
Mexican Hat Wavelet Approximation:
The script employs the Mexican Hat Wavelet, a mathematical tool that approximates price movements based on the Laplacian of the price series. This helps capture localized oscillations in price, acting as a filter to highlight certain price dynamics over the specified length. This wavelet is commonly used to identify key inflection points and trends in financial data.
Fractal Dimension Calculation:
The fractal dimension is calculated to quantify the market's complexity. It measures how price moves between intervals, with higher values indicating chaotic or more volatile market behavior. This dimension captures the self-similarity in price movements across different time frames, a key feature of fractals.
Shannon Entropy Calculation:
Shannon Entropy is used to measure the randomness or uncertainty in the price action. It calculates the degree of unpredictability based on the price changes, providing insight into the market's informational efficiency. Higher entropy indicates more randomness, while lower entropy suggests more predictable trends.
Custom Normalization:
The script includes a custom normalization function that processes the composite score (derived from fractal dimension and entropy). This normalization helps scale the values into a consistent range, making it easier to interpret the output. The smoothing factor and RSI-based approach ensure that the normalized value reacts smoothly to the changes in market dynamics.
Composite Score:
The composite score is a weighted combination of the fractal dimension and entropy. This score aims to provide a holistic view of the market by combining the structural complexity (fractal) and randomness (entropy) into one unified metric.
Plotting and Visuals:
The indicator plots the normalized composite score on a scale where a baseline of 50 is provided for reference. The resulting plot helps traders visualize market dynamics, with the score fluctuating based on changes in the market's fractal dimension and entropy. A score above or below the baseline of 50 indicates potential market shifts.
Use Case:
The "Enhanced Fractal and Entropy Market Dynamics with Mexican Hat Wavelet" is useful for traders looking to identify market conditions where there is a balance between price structure and randomness. By integrating wavelets, fractals, and entropy, the indicator can provide insights into market complexity, helping traders recognize potential trend reversals, periods of consolidation, or increased volatility. This can be particularly effective for those employing swing trading or trend-following strategies
Macros ICT KillZones [TradingFinder] Times & Price Trading Setup🔵 Introduction
ICT Macros, developed by Michael Huddleston, also known as ICT (Inner Circle Trader), is a powerful trading tool designed to help traders identify the best trading opportunities during key time intervals like the London and New York trading sessions.
For traders aiming to capitalize on market volatility, liquidity shifts, and Fair Value Gaps (FVG), understanding and using these critical time zones can significantly improve trading outcomes.
In today’s highly competitive financial markets, identifying the moments when the market is seeking buy-side or sell-side liquidity, or filling price imbalances, is essential for maximizing profitability.
The ICT Macros indicator is built on the renowned ICT time and price theory, which enables traders to track and leverage key market dynamics such as breaks of highs and lows, imbalances, and liquidity hunts.
This indicator automatically detects crucial market times and optimizes strategies for traders by highlighting the specific moments when price movements are most likely to occur. A standout feature of ICT Macros is its automatic adjustment for Daylight Saving Time (DST), ensuring that traders remain synced with the correct session times.
This means you can rely on accurate market timing without the need for manual updates, allowing you to focus on capturing profitable trades during critical timeframes.
🔵 How to Use
The ICT Macros indicator helps you capitalize on trading opportunities during key market moments, particularly when the market is breaking highs or lows, filling Fair Value Gaps (FVG), or addressing imbalances. This indicator is particularly beneficial for traders who seek to identify liquidity, market volatility, and price imbalances.
🟣 Sessions
London Sessions
London Macro 1 :
UTC Time : 06:33 to 07:00
New York Time : 02:33 to 03:00
London Macro 2 :
UTC Time : 08:03 to 08:30
New York Time : 04:03 to 04:30
New York Sessions
New York Macro AM 1 :
UTC Time : 12:50 to 13:10
New York Time : 08:50 to 09:10
New York Macro AM 2 :
UTC Time : 13:50 to 14:10
New York Time : 09:50 to 10:10
New York Macro AM 3 :
UTC Time : 14:50 to 15:10
New York Time : 10:50 to 11:10
New York Lunch Macro :
UTC Time : 15:50 to 16:10
New York Time : 11:50 to 12:10
New York PM Macro :
UTC Time : 17:10 to 17:40
New York Time : 13:10 to 13:40
New York Last Hour Macro :
UTC Time : 19:15 to 19:45
New York Time : 15:15 to 15:45
These time intervals adjust automatically based on Daylight Saving Time (DST), helping traders to enter or exit trades during key market moments when price volatility is high.
Below are the main applications of this tool and how to incorporate it into your trading strategies :
🟣 Combining ICT Macros with Trading Strategies
The ICT Macros indicator can easily be used in conjunction with various trading strategies. Two well-known strategies that can be combined with this indicator include:
ICT 2022 Trading Model : This model is designed based on identifying market liquidity, structural price changes, and Fair Value Gaps (FVG). By using ICT Macros, you can identify the key time intervals when the market is seeking liquidity, filling imbalances, or breaking through important highs and lows, allowing you to enter or exit trades at the right moment.
Silver Bullet Strategy : This strategy, which is built around liquidity hunting and rapid price movements, can work more accurately with the help of ICT Macros. The indicator pinpoints precise liquidity times, helping traders take advantage of market shifts caused by filling Fair Value Gaps or correcting imbalances.
🟣 Capitalizing on Price Volatility During Key Times
Large market algorithms often seek liquidity or fill Fair Value Gaps (FVG) during the intervals marked by ICT Macros. These periods are when price volatility increases, and traders can use these moments to enter or exit trades.
For example, if sell-side liquidity is drained and the market fills an imbalance, the price might move toward buy-side liquidity. By identifying these moments, which may also involve breaking a previous high or low, you can leverage rapid market fluctuations to your advantage.
🟣 Identifying Liquidity and Price Imbalances
One of the important uses of ICT Macros is identifying points where the market is seeking liquidity and correcting imbalances. You can determine high or low liquidity levels in the market before each ICT Macro, as well as Fair Value Gaps (FVG) and price imbalances that need to be filled, using them to adjust your trading strategy. This capability allows you to manage trades based on liquidity shifts or imbalance corrections without needing a bias toward a specific direction.
🔵 Settings
The ICT Macros indicator offers various customization options, allowing users to tailor it to their specific needs. Below are the main settings:
Time Zone Mode : You can select one of the following options to define how time is displayed:
UTC : For traders who need to work with Universal Time.
Session Local Time : The local time corresponding to the London or New York markets.
Your Time Zone : You can specify your own time zone (e.g., "UTC-4:00").
Your Time Zone : If you choose "Your Time Zone," you can set your specific time zone. By default, this is set to UTC-4:00.
Show Range Time : This option allows you to display the time range of each session on the chart. If enabled, the exact start and end times of each interval are shown.
Show or Hide Time Ranges : Toggle on/off for visual clarity depending on user preference.
Custom Colors : Set distinct colors for each session, allowing users to personalize their chart based on their trading style.These settings allow you to adjust the key time intervals of each trading session to your preference and customize the time format according to your own needs.
🔵 Conclusion
The ICT Macros indicator is a powerful tool for traders, helping them to identify key time intervals where the market seeks liquidity or fills Fair Value Gaps (FVG), corrects imbalances, and breaks highs or lows. This tool is especially valuable for traders using liquidity-based strategies such as ICT 2022 or Silver Bullet.
One of the key features of this indicator is its support for Daylight Saving Time (DST), ensuring you are always in sync with the correct trading session timings without manual adjustments. This is particularly beneficial for traders operating across different time zones.
With ICT Macros, you can capitalize on crucial market opportunities during sensitive times, take advantage of imbalances, and enhance your trading strategies based on market volatility, liquidity shifts, and Fair Value Gaps.
DualTrend [CHE]DualTrend Indicator for TradingView
Overview
Introducing the DualTrend indicator, a powerful tool designed to enhance your trading strategies on TradingView. Inspired by the renowned HalfTrend Indicator developed by everget, DualTrend combines dual amplitude settings to provide clearer trend signals and more precise entry and exit points. Whether you're a beginner or an experienced trader, this indicator is crafted to assist you in making informed trading decisions with greater confidence.
Key Features
- Dual Amplitude Settings
- Fast Amplitude: Configurable to quickly respond to market changes, ideal for short-term trading.
- Slow Amplitude: Smoother and less sensitive, perfect for identifying long-term trends.
- Channel Deviation Control
- Customize the channel deviation to adjust the sensitivity of the trend lines based on market volatility.
- Visual Trade Signals
- Buy Signals: Indicated by green upward-pointing triangles below the price bars.
- Sell Signals: Indicated by red downward-pointing triangles above the price bars.
- Easily distinguishable signals to streamline your trading decisions.
- Customizable Alerts
- Set up alerts for buy and sell signals to stay informed in real-time, ensuring you never miss an opportunity.
- Clear Trend Lines
- Fast HalfTrend Line: Plotted in blue for quick trend identification.
- Slow HalfTrend Line: Plotted in orange for long-term trend analysis.
- User-Friendly Inputs
- Adjustable parameters to tailor the indicator to your specific trading style and market conditions.
How It Works
The DualTrend indicator calculates two HalfTrend lines based on different amplitude settings—Fast and Slow. These lines represent potential support and resistance levels derived from the average true range (ATR) and simple moving averages (SMA).
- Trend Detection:
- When the Fast HalfTrend line crosses above the Slow HalfTrend line, a Buy Signal is generated.
- Conversely, when the Fast HalfTrend line crosses below the Slow HalfTrend line, a Sell Signal is triggered.
- Adaptive Channels:
- The indicator dynamically adjusts the channels around the trend lines using ATR-based deviations, providing a responsive measure to market volatility.
Why Choose DualTrend ?
- Inspired by Excellence: Built upon the foundational principles of the HalfTrend Indicator by everget, DualTrend offers enhanced functionality and flexibility.
- Versatile Application: Suitable for various financial instruments, including stocks, forex, commodities, and cryptocurrencies.
- Educational Purpose: Designed to help traders understand and implement trend-following strategies effectively.
Disclaimer
Disclaimer:
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Installation & Usage
1. Add to TradingView:
- Copy the provided Pine Script code.
- Open TradingView and navigate to the Pine Script editor.
- Paste the code and save the script as "DualTrend ".
- Add the indicator to your chart.
2. Customize Settings:
- Adjust the Fast Amplitude and Slow Amplitude to match your trading preferences.
- Modify the Channel Deviation to control the sensitivity of the trend lines.
- Toggle Show Arrows to display or hide buy/sell signals.
3. Set Up Alerts:
- Configure alerts based on the buy and sell signals to receive real-time notifications.
Conclusion
Elevate your trading strategy with the DualTrend indicator. Leveraging the proven methodology of the HalfTrend Indicator by everget, this tool offers dual trend analysis, customizable settings, and clear visual signals to help you navigate the markets with precision. Whether you're aiming to capture short-term movements or identify long-term trends, DualTrend is your reliable companion on TradingView.
Happy Trading!
Best regards
Chervolino
This indicator is inspired by the well-known Everget HalfTrend:
Bernoulli Price Dynamics with IntraBar Volume (Bidirectional)This indicator adapts the principles of Bernoulli’s equation from fluid dynamics to analyze price and volume dynamics in the market. By incorporating intrabar volume data and splitting price movements into upward and downward components, it provides a bidirectional view of the market's kinetic and potential energies. This approach helps assess market pressure in both upward and downward directions, offering insights into potential price movement with energy-based mechanics.
Key Features:
Intrabar Volume Integration: The indicator collects up and down volume data from a lower timeframe, such as seconds or minutes, to provide more granular insights.
Bidirectional Market Pressure: By separating upward and downward price movements, it calculates market pressure in both directions, which is akin to fluid pressure. The separation enables tracking of distinct upward and downward energy flows in the market.
Energy Calculation:
Kinetic Energy: This represents the "movement" aspect of the price, weighted by volume. It is calculated for both upward and downward movements based on price velocity squared.
Potential Energy: This represents the "position" aspect of the price, calculated as the product of volume and the current price level. It is also separated into upward and downward components.
Market Pressure: The difference between the total energy (sum of kinetic and potential energies) and the highest observed total energy over a defined period (N). This provides an insight into the current momentum of price movement in both directions.
Visualization:
Market Pressure Up/Down: Plots the calculated market pressure for upward (green) and downward (red) movements.
Kinetic and Potential Energies: Provides individual plots for kinetic and potential energy in both directions to analyze the behavior of price and volume in more detail.
This indicator can be used to track market momentum and potential reversals by understanding the energy and pressure dynamics in both upward and downward price movements.
Enhanced volumeHi all!
This indicator plots volume at the bottom of the chart and the volume Moving Average (with the choice of Simple Moving Average (SMA) (default), Exponential Moving Average (EMA) and Volume Weighted Moving Average (VWMA)) and desired length (defaults to 20). It then changes the transparency of the volume (and the bars body) based on the close and the volume. It also changes the bar transparency. All these visual changes can be configured in the "Style" tab in the indicators settings.
The opacity will be high when the close is considered to be a "Strong close (%)" and has a bigger volume than any of the red closing in the last 10 bars. This "Strong close (%)" is defaulted to 50 which means that the bar needs to close equal or higher than 50% of the bar.
You also have an option to include red bars, which are excluded by default.
This indicator can help you to spot bars with relevant volume and find reversals.
I hope this explanation makes sense, let me know otherwise. Also let me know if you have any suggestions on improvements.
Best of trading luck!
FuTech V-Spike & V-HighlighterFuTech V-Spike & V-Highlighter
In the context of trading and technical analysis, this volume spike & volume highlighter indicator is the perfect indicator used to assess market activity and make informed trading decisions.
Let's Understand in brief as below :
1) Volume Spike :
A volume spike refers to a sudden, significant increase in trading volume compared to the average volume over a specific period.
This spike can indicate heightened interest in a particular security, often preceding price movements.
Traders may look for volume spikes as signals for potential buy or sell opportunities because they can suggest that a stock is experiencing increased activity, possibly due to news, earnings releases, or other catalysts.
Characteristics of a Volume Spike:
Assess the sudden increase in trading volume.
It Can occur in both upward and downward price movements.
Often compared to the average volume over a defined period (e.g., the last 20 days).
2) Volume Highlighter:
A volume highlighter emphasizes significant changes in trading volume on a price chart. This indicator typically uses color coding to highlight periods of high volume, making it easier for traders to identify volume spikes at a glance.
How this indicator works:
a) Volume Spike will calculate the highest volume spike as per the user defined threshold multiplier. (Multiplier = when volume exceeds a certain threshold)
b) The threshold Multiplier can be set based on a fixed number or as a multiple of the Exponential Moving Average volume. Volume Spike Multiplier default is 1.5, means the EMA volume should cross 1.5 times the user defined lookback period
c) The result is derived from the user defined lookback candles by using its EMA instead of SMA, which will give us more precise results.
d) By default, last 10 candles EMA average is used to calculate the Volume Spike but you can choose your lookback period as many days, weeks, months, years of your choice !
e) In Volume Spike -
- Green candle will show Yellow color Bar as Bullish sentiments, whereas
- Red candle will show Black Bar as Bearish sentiments.
f) Volume Highlighter will highlight the candles background if the highest volume is crossing as per the the user defined lookback period
g) Default Lookback period is 20, Color coding (e.g., Blue for bullish spikes, Red for bearish spikes) helps traders quickly assess the volume context.
h) Volume Highlighter plotting shapes and positions can be modified
Illustration:
From the Above pic,
If last Volume Spike is 10 lookback candles, Spike multiplier is 1.5 and Highlighter lookback candles is 20,
Then yellow candle means the spike in volume which is 1.5 times higher than the last 10 candles
Highlighting color defines the highest volumes trading from the last 20 candles which is either Blue (Bullish) or Red (Bearish) sentiments
Conclusion :
Using FuTech V-Spike & V-Highlighter indicator - will help traders identify potential trading opportunities and better understand market dynamics.
By analyzing volume in conjunction with price movements, traders can make more informed decisions based on market sentiment.
Thank you !
Jai Swaminarayan Dasna Das !
He Hari ! Bas Ek Tu Raji Tha !
RV- Dynamic Trend AnalyzerRV Dynamic Trend Analyzer
The RV Dynamic Trend Analyzer is a powerful TradingView indicator designed to help traders identify and capitalize on trends across multiple time frames—daily, weekly, and monthly. With dynamic adjustments to key technical indicators like EMA and MACD, the tool adapts to different chart periods, ensuring more accurate signals. Whether you are swing trading or holding longer-term positions, this indicator provides reliable buy/sell signals, breakout opportunities, and customizable visual elements to enhance decision-making. Its intelligent use of EMAs and MACD values ensures high potential returns, making it suitable for traders seeking strong, data-driven strategies. Below are its core features and their respective benefits.
Supertrend Indicator:
Importance: The Supertrend is a trend-following tool that helps traders identify the market’s direction by offering clear buy and sell signals based on price movement relative to the Supertrend line.
Benefits:
Helps filter out market noise and enables traders to stay in trends longer.
The pullback detection feature enhances trade timing by identifying potential entry points during retracements.
ATH/ATL & 52-Week High/Low with Candle Coloring:
Importance: Tracking all-time highs (ATH), all-time lows (ATL), and 52-week high/low levels helps traders identify key support and resistance levels.
Benefits:
Offers insights into the strength of price movements and potential reversal zones.
Candle coloring improves visual analysis, allowing quick identification of bullish or bearish conditions at critical levels.
Multi-Time Frame Analysis
Importance: The ability to view indicators like RSI and MACD across multiple time frames provides a more in-depth and comprehensive view of market behavior, allowing traders to make informed decisions that align with both short-term and long-term trends.
Benefits:
Align Strategies Across Time frames: By using multiple time frames, traders can align their strategies with larger trends (such as weekly or daily) while executing trades on lower time frames (like 1-minute or 5-minute charts). This improves the accuracy of trade entries and exits.
Reduce False Signals: Viewing key technical indicators like RSI and MACD across different time frames reduces the likelihood of false signals by offering a broader market context, filtering out noise from smaller time frames.
Customization of Table Display: Traders can customize the position and size of a table that displays RSI and MACD values for selected time frames. This flexibility enhances visibility and ease of analysis.
Time frame-Specific Data: The code allows for displaying RSI and MACD data for up to seven different time frames, making it highly customizable for traders depending on their preferred analysis period.
Visual Clarity: The table displays key values such as RSI and MACD histogram readings in a visually clear format, with color coding to quickly indicate overbought/oversold levels or MACD crossovers.
Pivot Points:
Importance: Pivot points serve as key support and resistance levels that help predict potential price movements.
Benefits:
Assists in identifying potential reversal zones and breakout points, aiding in trade planning.
Displaying pivot points across multiple time frames enhances market insight and improves strategic planning.
Quarterly Earnings Table:
Importance: Understanding a company’s quarterly earnings releases is crucial, as these events often lead to significant price volatility. Traders can leverage this information to adjust their strategies around earnings reports and prevent unexpected losses.
Benefits:
Helps traders anticipate potential price movements due to earnings reports.
Allows traders to avoid sudden losses by being aware of important earnings announcements and adjusting positions accordingly.
Customizable Visuals for Traders:
Dark Mode: Toggle between dark and light themes based on your chart's color scheme.
Mini Mode: A condensed version that visually simplifies the data, making it quicker to interpret through color-coded traffic lights (green for positive, red for negative).
Table Size & Position: Customize the size and position of the table for better visibility on your charts.
Data Period (FQ vs FY): Easily switch between displaying quarterly or yearly data based on the selected period.
Top-Left Cell Display: Option to display Free Float or Market Cap in the top-left cell for quick reference.
Exponential Moving Averages (EMAs) with Adjustable Lengths:
Importance: EMAs are essential for identifying trends and generating reliable buy/sell signals. The indicator plots four EMAs that dynamically adjust based on the selected time frame.
Benefits:
Dynamic Time frame Logic: EMA lengths and sources automatically adapt based on whether the user selects daily, weekly, or monthly time frames. This ensures the EMAs are relevant for the chosen strategy.
Multiple EMAs: By incorporating four different EMAs, users can observe both short-term and long-term trends simultaneously, improving their ability to identify key trend shifts.
Breakout Arrow Functionality:
Importance: This feature visually signals potential buy/sell opportunities based on the interaction between EMAs and MACD crossovers.
Benefits:
Crossover Signals: Arrows are plotted when EMAs and MACD cross, indicating breakout opportunities and aiding in quick trade decisions.
RSI Filter Option: Users can apply an optional RSI filter to refine buy/sell signals, reducing false signals and improving overall accuracy.
Disclaimer:
Before engaging in actual trading, we strongly recommend back testing the this indicator to ensure it fits your trading style and risk tolerance. Be sure to adjust your risk-reward ratio and set appropriate stop-loss levels to safeguard your investments. Proper risk management is key to successful trading.
ICT Master Suite [Trading IQ]Hello Traders!
We’re excited to introduce the ICT Master Suite by TradingIQ, a new tool designed to bring together several ICT concepts and strategies in one place.
The Purpose Behind the ICT Master Suite
There are a few challenges traders often face when using ICT-related indicators:
Many available indicators focus on one or two ICT methods, which can limit traders who apply a broader range of ICT related techniques on their charts.
There aren't many indicators for ICT strategy models, and we couldn't find ICT indicators that allow for testing the strategy models and setting alerts.
Many ICT related concepts exist in the public domain as indicators, not strategies! This makes it difficult to verify that the ICT concept has some utility in the market you're trading and if it's worth trading - it's difficult to know if it's working!
Some users might not have enough chart space to apply numerous ICT related indicators, which can be restrictive for those wanting to use multiple ICT techniques simultaneously.
The ICT Master Suite is designed to offer a comprehensive option for traders who want to apply a variety of ICT methods. By combining several ICT techniques and strategy models into one indicator, it helps users maximize their chart space while accessing multiple tools in a single slot.
Additionally, the ICT Master Suite was developed as a strategy . This means users can backtest various ICT strategy models - including deep backtesting. A primary goal of this indicator is to let traders decide for themselves what markets to trade ICT concepts in and give them the capability to figure out if the strategy models are worth trading!
What Makes the ICT Master Suite Different
There are many ICT-related indicators available on TradingView, each offering valuable insights. What the ICT Master Suite aims to do is bring together a wider selection of these techniques into one tool. This includes both key ICT methods and strategy models, allowing traders to test and activate strategies all within one indicator.
Features
The ICT Master Suite offers:
Multiple ICT strategy models, including the 2022 Strategy Model and Unicorn Model, which can be built, tested, and used for live trading.
Calculation and display of key price areas like Breaker Blocks, Rejection Blocks, Order Blocks, Fair Value Gaps, Equal Levels, and more.
The ability to set alerts based on these ICT strategies and key price areas.
A comprehensive, yet practical, all-inclusive ICT indicator for traders.
Customizable Timeframe - Calculate ICT concepts on off-chart timeframes
Unicorn Strategy Model
2022 Strategy Model
Liquidity Raid Strategy Model
OTE (Optimal Trade Entry) Strategy Model
Silver Bullet Strategy Model
Order blocks
Breaker blocks
Rejection blocks
FVG
Strong highs and lows
Displacements
Liquidity sweeps
Power of 3
ICT Macros
HTF previous bar high and low
Break of Structure indications
Market Structure Shift indications
Equal highs and lows
Swings highs and swing lows
Fibonacci TPs and SLs
Swing level TPs and SLs
Previous day high and low TPs and SLs
And much more! An ongoing project!
How To Use
Many traders will already be familiar with the ICT related concepts listed above, and will find using the ICT Master Suite quite intuitive!
Despite this, let's go over the features of the tool in-depth and how to use the tool!
The image above shows the ICT Master Suite with almost all techniques activated.
ICT 2022 Strategy Model
The ICT Master suite provides the ability to test, set alerts for, and live trade the ICT 2022 Strategy Model.
The image above shows an example of a long position being entered following a complete setup for the 2022 ICT model.
A liquidity sweep occurs prior to an upside breakout. During the upside breakout the model looks for the FVG that is nearest 50% of the setup range. A limit order is placed at this FVG for entry.
The target entry percentage for the range is customizable in the settings. For instance, you can select to enter at an FVG nearest 33% of the range, 20%, 66%, etc.
The profit target for the model generally uses the highest high of the range (100%) for longs and the lowest low of the range (100%) for shorts. Stop losses are generally set at 0% of the range.
The image above shows the short model in action!
Whether you decide to follow the 2022 model diligently or not, you can still set alerts when the entry condition is met.
ICT Unicorn Model
The image above shows an example of a long position being entered following a complete setup for the ICT Unicorn model.
A lower swing low followed by a higher swing high precedes the overlap of an FVG and breaker block formed during the sequence.
During the upside breakout the model looks for an FVG and breaker block that formed during the sequence and overlap each other. A limit order is placed at the nearest overlap point to current price.
The profit target for this example trade is set at the swing high and the stop loss at the swing low. However, both the profit target and stop loss for this model are configurable in the settings.
For Longs, the selectable profit targets are:
Swing High
Fib -0.5
Fib -1
Fib -2
For Longs, the selectable stop losses are:
Swing Low
Bottom of FVG or breaker block
The image above shows the short version of the Unicorn Model in action!
For Shorts, the selectable profit targets are:
Swing Low
Fib -0.5
Fib -1
Fib -2
For Shorts, the selectable stop losses are:
Swing High
Top of FVG or breaker block
The image above shows the profit target and stop loss options in the settings for the Unicorn Model.
Optimal Trade Entry (OTE) Model
The image above shows an example of a long position being entered following a complete setup for the OTE model.
Price retraces either 0.62, 0.705, or 0.79 of an upside move and a trade is entered.
The profit target for this example trade is set at the -0.5 fib level. This is also adjustable in the settings.
For Longs, the selectable profit targets are:
Swing High
Fib -0.5
Fib -1
Fib -2
The image above shows the short version of the OTE Model in action!
For Shorts, the selectable profit targets are:
Swing Low
Fib -0.5
Fib -1
Fib -2
Liquidity Raid Model
The image above shows an example of a long position being entered following a complete setup for the Liquidity Raid Modell.
The user must define the session in the settings (for this example it is 13:30-16:00 NY time).
During the session, the indicator will calculate the session high and session low. Following a “raid” of either the session high or session low (after the session has completed) the script will look for an entry at a recently formed breaker block.
If the session high is raided the script will look for short entries at a bearish breaker block. If the session low is raided the script will look for long entries at a bullish breaker block.
For Longs, the profit target options are:
Swing high
User inputted Lib level
For Longs, the stop loss options are:
Swing low
User inputted Lib level
Breaker block bottom
The image above shows the short version of the Liquidity Raid Model in action!
For Shorts, the profit target options are:
Swing Low
User inputted Lib level
For Shorts, the stop loss options are:
Swing High
User inputted Lib level
Breaker block top
Silver Bullet Model
The image above shows an example of a long position being entered following a complete setup for the Silver Bullet Modell.
During the session, the indicator will determine the higher timeframe bias. If the higher timeframe bias is bullish the strategy will look to enter long at an FVG that forms during the session. If the higher timeframe bias is bearish the indicator will look to enter short at an FVG that forms during the session.
For Longs, the profit target options are:
Nearest Swing High Above Entry
Previous Day High
For Longs, the stop loss options are:
Nearest Swing Low
Previous Day Low
The image above shows the short version of the Silver Bullet Model in action!
For Shorts, the profit target options are:
Nearest Swing Low Below Entry
Previous Day Low
For Shorts, the stop loss options are:
Nearest Swing High
Previous Day High
Order blocks
The image above shows indicator identifying and labeling order blocks.
The color of the order blocks, and how many should be shown, are configurable in the settings!
Breaker Blocks
The image above shows indicator identifying and labeling order blocks.
The color of the breaker blocks, and how many should be shown, are configurable in the settings!
Rejection Blocks
The image above shows indicator identifying and labeling rejection blocks.
The color of the rejection blocks, and how many should be shown, are configurable in the settings!
Fair Value Gaps
The image above shows indicator identifying and labeling fair value gaps.
The color of the fair value gaps, and how many should be shown, are configurable in the settings!
Additionally, you can select to only show fair values gaps that form after a liquidity sweep. Doing so reduces "noisy" FVGs and focuses on identifying FVGs that form after a significant trading event.
The image above shows the feature enabled. A fair value gap that occurred after a liquidity sweep is shown.
Market Structure
The image above shows the ICT Master Suite calculating market structure shots and break of structures!
The color of MSS and BoS, and whether they should be displayed, are configurable in the settings.
Displacements
The images above show indicator identifying and labeling displacements.
The color of the displacements, and how many should be shown, are configurable in the settings!
Equal Price Points
The image above shows the indicator identifying and labeling equal highs and equal lows.
The color of the equal levels, and how many should be shown, are configurable in the settings!
Previous Custom TF High/Low
The image above shows the ICT Master Suite calculating the high and low price for a user-defined timeframe. In this case the previous day’s high and low are calculated.
To illustrate the customizable timeframe function, the image above shows the indicator calculating the previous 4 hour high and low.
Liquidity Sweeps
The image above shows the indicator identifying a liquidity sweep prior to an upside breakout.
The image above shows the indicator identifying a liquidity sweep prior to a downside breakout.
The color and aggressiveness of liquidity sweep identification are adjustable in the settings!
Power Of Three
The image above shows the indicator calculating Po3 for two user-defined higher timeframes!
Macros
The image above shows the ICT Master Suite identifying the ICT macros!
ICT Macros are only displayable on the 5 minute timeframe or less.
Strategy Performance Table
In addition to a full-fledged TradingView backtest for any of the ICT strategy models the indicator offers, a quick-and-easy strategy table exists for the indicator!
The image above shows the strategy performance table in action.
Keep in mind that, because the ICT Master Suite is a strategy script, you can perform fully automatic backtests, deep backtests, easily add commission and portfolio balance and look at pertinent metrics for the ICT strategies you are testing!
Lite Mode
Traders who want the cleanest chart possible can toggle on “Lite Mode”!
In Lite Mode, any neon or “glow” like effects are removed and key levels are marked as strict border boxes. You can also select to remove box borders if that’s what you prefer!
Settings Used For Backtest
For the displayed backtest, a starting balance of $1000 USD was used. A commission of 0.02%, slippage of 2 ticks, a verify price for limit orders of 2 ticks, and 5% of capital investment per order.
A commission of 0.02% was used due to the backtested asset being a perpetual future contract for a crypto currency. The highest commission (lowest-tier VIP) for maker orders on many exchanges is 0.02%. All entered positions take place as maker orders and so do profit target exits. Stop orders exist as stop-market orders.
A slippage of 2 ticks was used to simulate more realistic stop-market orders. A verify limit order settings of 2 ticks was also used. Even though BTCUSDT.P on Binance is liquid, we just want the backtest to be on the safe side. Additionally, the backtest traded 100+ trades over the period. The higher the sample size the better; however, this example test can serve as a starting point for traders interested in ICT concepts.
Community Assistance And Feedback
Given the complexity and idiosyncratic applications of ICT concepts amongst its proponents, the ICT Master Suite’s built-in strategies and level identification methods might not align with everyone's interpretation.
That said, the best we can do is precisely define ICT strategy rules and concepts to a repeatable process, test, and apply them! Whether or not an ICT strategy is trading precisely how you would trade it, seeing the model in action, taking trades, and with performance statistics is immensely helpful in assessing predictive utility.
If you think we missed something, you notice a bug, have an idea for strategy model improvement, please let us know! The ICT Master Suite is an ongoing project that will, ideally, be shaped by the community.
A big thank you to the @PineCoders for their Time Library!
Thank you!
Relative VolatilityRelative Volatility is a technical indicator designed to assess changes in market volatility by comparing fast and slow Average True Range (ATR) values. It operates by subtracting a slower ATR (e.g., 50-period ATR) from a faster ATR (e.g., 20-period ATR) and visualizing the result as a histogram. This enables traders to determine whether volatility is increasing or decreasing over time.
This indicator can help traders recognize volatility trends, which can inform decisions related to trade entries, exits, and risk management.
Interpreting Volatility Changes
Increasing Volatility: When the histogram is above zero, it indicates that the fast ATR is greater than the slow ATR, signifying an increase in short-term volatility compared to the long-term average. This may suggest heightened market activity and potential trading opportunities.
Decreasing Volatility: When the histogram is below zero, it shows that the fast ATR is less than the slow ATR, indicating a decrease in short-term volatility relative to the long-term average. This may suggest consolidating markets or reduced trading activity.
Relative Volatility assists traders in monitoring and analyzing changes in market volatility, providing insights that can enhance trading strategies and decision-making processes.
Savitzky-Golay Z-Score [BackQuant]Savitzky-Golay Z-Score
The Savitzky-Golay Z-Score is a powerful trading indicator that combines the precision of the Savitzky-Golay filter with the statistical strength of the Z-Score. This advanced indicator is designed to detect trend shifts, identify overbought or oversold conditions, and highlight potential divergences in the market, providing traders with a unique edge in detecting momentum changes and trend reversals.
Core Concept: Savitzky-Golay Filter
The Savitzky-Golay filter is a widely-used smoothing technique that preserves important signal features such as peak detection while filtering out noise. In this indicator, the filter is applied to price data (default set to HLC3) to smooth out volatility and produce a cleaner trend line. By specifying the window size and polynomial degree, traders can fine-tune the degree of smoothing to match their preferred trading style or market conditions.
Z-Score: Measuring Deviation
The Z-Score is a statistical measure that indicates how far the current price is from its mean in terms of standard deviations. In trading, the Z-Score can be used to identify extreme price moves that are likely to revert or continue trending. A positive Z-Score means the price is above the mean, while a negative Z-Score indicates the price is below the mean.
This script calculates the Z-Score based on the Savitzky-Golay filtered price, enabling traders to detect moments when the price is diverging from its typical range and may present an opportunity for a trade.
Long and Short Conditions
The Savitzky-Golay Z-Score generates clear long and short signals based on the Z-Score value:
Long Signals : When the Z-Score is positive, indicating the price is above its smoothed mean, a long signal is generated. The color of the bars turns green, signaling upward momentum.
Short Signals : When the Z-Score is negative, indicating the price is below its smoothed mean, a short signal is generated. The bars turn red, signaling downward momentum.
These signals allow traders to follow the prevailing trend with confidence, using statistical backing to avoid false signals from short-term volatility.
Standard Deviation Levels and Extreme Levels
This indicator includes several features to help visualize overbought and oversold conditions:
Standard Deviation Levels: The script plots horizontal lines at +1, +2, -1, and -2 standard deviations. These levels provide a reference for how far the current price is from the mean, allowing traders to quickly identify when the price is moving into extreme territory.
Extreme Levels: Additional extreme levels at +3 and +4 (and their negative counterparts) are plotted to highlight areas where the price is highly likely to revert. These extreme levels provide important insight into market conditions that are far outside the norm, signaling caution or potential reversal zones.
The indicator also adapts the color shading of these extreme zones based on the Z-Score’s strength. For example, the area between +3 and +4 is shaded with a stronger color when the Z-Score approaches these values, giving a visual representation of market pressure.
Divergences: Detecting Hidden and Regular Signals
A key feature of the Savitzky-Golay Z-Score is its ability to detect bullish and bearish divergences, both regular and hidden:
Regular Bullish Divergence: This occurs when the price makes a lower low while the Z-Score forms a higher low. It signals that bearish momentum is weakening, and a bullish reversal could be near.
Hidden Bullish Divergence: This divergence occurs when the price makes a higher low while the Z-Score forms a lower low. It signals that bullish momentum may continue after a temporary pullback.
Regular Bearish Divergence: This occurs when the price makes a higher high while the Z-Score forms a lower high, signaling that bullish momentum is weakening and a bearish reversal may be near.
Hidden Bearish Divergence: This divergence occurs when the price makes a lower high while the Z-Score forms a higher high, indicating that bearish momentum may continue after a temporary rally.
These divergences are plotted directly on the chart, making it easier for traders to spot when the price and momentum are out of sync and when a potential reversal may occur.
Customization and Visualization
The Savitzky-Golay Z-Score offers a range of customization options to fit different trading styles:
Window Size and Polynomial Degree: Adjust the window size and polynomial degree of the Savitzky-Golay filter to control how much smoothing is applied to the price data.
Z-Score Lookback Period: Set the lookback period for calculating the Z-Score, allowing traders to fine-tune the sensitivity to short-term or long-term price movements.
Display Options: Choose whether to display standard deviation levels, extreme levels, and divergence labels on the chart.
Bar Color: Color the price bars based on trend direction, with green for bullish trends and red for bearish trends, allowing traders to easily visualize the current momentum.
Divergences: Enable or disable divergence detection, and adjust the lookback periods for pivots used to detect regular and hidden divergences.
Alerts and Automation
To ensure you never miss an important signal, the indicator includes built-in alert conditions for the following events:
Positive Z-Score (Long Signal): Triggers an alert when the Z-Score crosses above zero, indicating a potential buying opportunity.
Negative Z-Score (Short Signal): Triggers an alert when the Z-Score crosses below zero, signaling a potential short opportunity.
Shifting Momentum: Alerts when the Z-Score is shifting up or down, providing early warning of changing market conditions.
These alerts can be configured to notify you via email, SMS, or app notification, allowing you to stay on top of the market without having to constantly monitor the chart.
Trading Applications
The Savitzky-Golay Z-Score is a versatile tool that can be applied across multiple trading strategies:
Trend Following: By smoothing the price and calculating the Z-Score, this indicator helps traders follow the prevailing trend while avoiding false signals from short-term volatility.
Mean Reversion: The Z-Score highlights moments when the price is far from its mean, helping traders identify overbought or oversold conditions and capitalize on potential reversals.
Divergence Trading: Regular and hidden divergences between the Z-Score and price provide early warning of trend reversals, allowing traders to enter trades at opportune moments.
Final Thoughts
The Savitzky-Golay Z-Score is an advanced statistical tool designed to provide a clearer view of market trends and momentum. By applying the Savitzky-Golay filter and Z-Score analysis, this indicator reduces noise and highlights key areas where the market may reverse or accelerate, giving traders a significant edge in understanding price behavior.
Whether you’re a trend follower or a reversal trader, this indicator offers the flexibility and insights you need to navigate complex markets with confidence.
Freak VolumeFreak Volume is a technical indicator designed to identify bars with exceptionally high trading volume. It operates by calculating the mean volume over a specified period and determines high volume thresholds using both multiples of the mean and standard deviations from this mean.
High Volume Identification:
Standard Deviation Threshold: Bars with volume exceeding a specified number of standard deviations above the mean are highlighted within the indicator and on the corresponding candlesticks on the chart.
Mean Multiple Threshold: Bars with volume exceeding a multiple of the average volume are also highlighted. This highlighting is secondary to the standard deviation threshold, meaning standard deviation-based highlights take precedence.
Price Range Plotting: The indicator offers an option to display the price range of high volume candles, which may serve as potential supply and demand zones or support and resistance levels.
Freak Volume assists traders in visually identifying significant volume spikes that could indicate important market activity or potential turning points by providing multiple methods of high volume detection.
Trading IQ - ICT LibraryLibrary "ICTlibrary"
Used to calculate various ICT related price levels and strategies. An ongoing project.
Hello Coders!
This library is meant for sourcing ICT related concepts. While some functions might generate more output than you require, you can specify "Lite Mode" as "true" in applicable functions to slim down necessary inputs.
isLastBar(userTF)
Identifies the last bar on the chart before a timeframe change
Parameters:
userTF (simple int) : the timeframe you wish to calculate the last bar for, must be converted to integer using 'timeframe.in_seconds()'
Returns: bool true if bar on chart is last bar of higher TF, dalse if bar on chart is not last bar of higher TF
necessaryData(atrTF)
returns necessaryData UDT for historical data access
Parameters:
atrTF (float) : user-selected timeframe ATR value.
Returns: logZ. log return Z score, used for calculating order blocks.
method gradBoxes(gradientBoxes, idColor, timeStart, bottom, top, rightCoordinate)
creates neon like effect for box drawings
Namespace types: array
Parameters:
gradientBoxes (array) : an array.new() to store the gradient boxes
idColor (color)
timeStart (int) : left point of box
bottom (float) : bottom of box price point
top (float) : top of box price point
rightCoordinate (int) : right point of box
Returns: void
checkIfTraded(tradeName)
checks if recent trade is of specific name
Parameters:
tradeName (string)
Returns: bool true if recent trade id matches target name, false otherwise
checkIfClosed(tradeName)
checks if recent closed trade is of specific name
Parameters:
tradeName (string)
Returns: bool true if recent closed trade id matches target name, false otherwise
IQZZ(atrMult, finalTF)
custom ZZ to quickly determine market direction.
Parameters:
atrMult (float) : an atr multiplier used to determine the required price move for a ZZ direction change
finalTF (string) : the timeframe used for the atr calcuation
Returns: dir market direction. Up => 1, down => -1
method drawBos(id, startPoint, getKeyPointTime, getKeyPointPrice, col, showBOS, isUp)
calculates and draws Break Of Structure
Namespace types: array
Parameters:
id (array)
startPoint (chart.point)
getKeyPointTime (int) : the actual time of startPoint, simplystartPoint.time
getKeyPointPrice (float) : the actual time of startPoint, simplystartPoint.price
col (color) : color of the BoS line / label
showBOS (bool) : whether to show label/line. This function still calculates internally for other ICT related concepts even if not drawn.
isUp (bool) : whether BoS happened during price increase or price decrease.
Returns: void
method drawMSS(id, startPoint, getKeyPointTime, getKeyPointPrice, col, showMSS, isUp, upRejections, dnRejections, highArr, lowArr, timeArr, closeArr, openArr, atrTFarr, upRejectionsPrices, dnRejectionsPrices)
calculates and draws Market Structure Shift. This data is also used to calculate Rejection Blocks.
Namespace types: array
Parameters:
id (array)
startPoint (chart.point)
getKeyPointTime (int) : the actual time of startPoint, simplystartPoint.time
getKeyPointPrice (float) : the actual time of startPoint, simplystartPoint.price
col (color) : color of the MSS line / label
showMSS (bool) : whether to show label/line. This function still calculates internally for other ICT related concepts even if not drawn.
isUp (bool) : whether MSS happened during price increase or price decrease.
upRejections (array)
dnRejections (array)
highArr (array) : array containing historical highs, should be taken from the UDT "necessaryData" defined above
lowArr (array) : array containing historical lows, should be taken from the UDT "necessaryData" defined above
timeArr (array) : array containing historical times, should be taken from the UDT "necessaryData" defined above
closeArr (array) : array containing historical closes, should be taken from the UDT "necessaryData" defined above
openArr (array) : array containing historical opens, should be taken from the UDT "necessaryData" defined above
atrTFarr (array) : array containing historical atr values (of user-selected TF), should be taken from the UDT "necessaryData" defined above
upRejectionsPrices (array) : array containing up rejections prices. Is sorted and used to determine selective looping for invalidations.
dnRejectionsPrices (array) : array containing down rejections prices. Is sorted and used to determine selective looping for invalidations.
Returns: void
method getTime(id, compare, timeArr)
gets time of inputted price (compare) in an array of data
this is useful when the user-selected timeframe for ICT concepts is greater than the chart's timeframe
Namespace types: array
Parameters:
id (array) : the array of data to search through, to find which index has the same value as "compare"
compare (float) : the target data point to find in the array
timeArr (array) : array of historical times
Returns: the time that the data point in the array was recorded
method OB(id, highArr, signArr, lowArr, timeArr, sign)
store bullish orderblock data
Namespace types: array
Parameters:
id (array)
highArr (array) : array of historical highs
signArr (array) : array of historical price direction "math.sign(close - open)"
lowArr (array) : array of historical lows
timeArr (array) : array of historical times
sign (int) : orderblock direction, -1 => bullish, 1 => bearish
Returns: void
OTEstrat(OTEstart, future, closeArr, highArr, lowArr, timeArr, longOTEPT, longOTESL, longOTElevel, shortOTEPT, shortOTESL, shortOTElevel, structureDirection, oteLongs, atrTF, oteShorts)
executes the OTE strategy
Parameters:
OTEstart (chart.point)
future (int) : future time point for drawings
closeArr (array) : array of historical closes
highArr (array) : array of historical highs
lowArr (array) : array of historical lows
timeArr (array) : array of historical times
longOTEPT (string) : user-selected long OTE profit target, please create an input.string() for this using the example below
longOTESL (int) : user-selected long OTE stop loss, please create an input.string() for this using the example below
longOTElevel (float) : long entry price of selected retracement ratio for OTE
shortOTEPT (string) : user-selected short OTE profit target, please create an input.string() for this using the example below
shortOTESL (int) : user-selected short OTE stop loss, please create an input.string() for this using the example below
shortOTElevel (float) : short entry price of selected retracement ratio for OTE
structureDirection (string) : current market structure direction, this should be "Up" or "Down". This is used to cancel pending orders if market structure changes
oteLongs (bool) : input.bool() for whether OTE longs can be executed
atrTF (float) : atr of the user-seleceted TF
oteShorts (bool) : input.bool() for whether OTE shorts can be executed
@exampleInputs
oteLongs = input.bool(defval = false, title = "OTE Longs", group = "Optimal Trade Entry")
longOTElevel = input.float(defval = 0.79, title = "Long Entry Retracement Level", options = , group = "Optimal Trade Entry")
longOTEPT = input.string(defval = "-0.5", title = "Long TP", options = , group = "Optimal Trade Entry")
longOTESL = input.int(defval = 0, title = "How Many Ticks Below Swing Low For Stop Loss", group = "Optimal Trade Entry")
oteShorts = input.bool(defval = false, title = "OTE Shorts", group = "Optimal Trade Entry")
shortOTElevel = input.float(defval = 0.79, title = "Short Entry Retracement Level", options = , group = "Optimal Trade Entry")
shortOTEPT = input.string(defval = "-0.5", title = "Short TP", options = , group = "Optimal Trade Entry")
shortOTESL = input.int(defval = 0, title = "How Many Ticks Above Swing Low For Stop Loss", group = "Optimal Trade Entry")
Returns: void (0)
displacement(logZ, atrTFreg, highArr, timeArr, lowArr, upDispShow, dnDispShow, masterCoords, labelLevels, dispUpcol, rightCoordinate, dispDncol, noBorders)
calculates and draws dispacements
Parameters:
logZ (float) : log return of current price, used to determine a "significant price move" for a displacement
atrTFreg (float) : atr of user-seleceted timeframe
highArr (array) : array of historical highs
timeArr (array) : array of historical times
lowArr (array) : array of historical lows
upDispShow (int) : amount of historical upside displacements to show
dnDispShow (int) : amount of historical downside displacements to show
masterCoords (map) : a map to push the most recent displacement prices into, useful for having key levels in one data structure
labelLevels (string) : used to determine label placement for the displacement, can be inside box, outside box, or none, example below
dispUpcol (color) : upside displacement color
rightCoordinate (int) : future time for displacement drawing, best is "last_bar_time"
dispDncol (color) : downside displacement color
noBorders (bool) : input.bool() to remove box borders, example below
@exampleInputs
labelLevels = input.string(defval = "Inside" , title = "Box Label Placement", options = )
noBorders = input.bool(defval = false, title = "No Borders On Levels")
Returns: void
method getStrongLow(id, startIndex, timeArr, lowArr, strongLowPoints)
unshift strong low data to array id
Namespace types: array
Parameters:
id (array)
startIndex (int) : the starting index for the timeArr array of the UDT "necessaryData".
this point should start from at least 1 pivot prior to find the low before an upside BoS
timeArr (array) : array of historical times
lowArr (array) : array of historical lows
strongLowPoints (array) : array of strong low prices. Used to retrieve highest strong low price and see if need for
removal of invalidated strong lows
Returns: void
method getStrongHigh(id, startIndex, timeArr, highArr, strongHighPoints)
unshift strong high data to array id
Namespace types: array
Parameters:
id (array)
startIndex (int) : the starting index for the timeArr array of the UDT "necessaryData".
this point should start from at least 1 pivot prior to find the high before a downside BoS
timeArr (array) : array of historical times
highArr (array) : array of historical highs
strongHighPoints (array)
Returns: void
equalLevels(highArr, lowArr, timeArr, rightCoordinate, equalHighsCol, equalLowsCol, liteMode)
used to calculate recent equal highs or equal lows
Parameters:
highArr (array) : array of historical highs
lowArr (array) : array of historical lows
timeArr (array) : array of historical times
rightCoordinate (int) : a future time (right for boxes, x2 for lines)
equalHighsCol (color) : user-selected color for equal highs drawings
equalLowsCol (color) : user-selected color for equal lows drawings
liteMode (bool) : optional for a lite mode version of an ICT strategy. For more control over drawings leave as "True", "False" will apply neon effects
Returns: void
quickTime(timeString)
used to quickly determine if a user-inputted time range is currently active in NYT time
Parameters:
timeString (string) : a time range
Returns: true if session is active, false if session is inactive
macros(showMacros, noBorders)
used to calculate and draw session macros
Parameters:
showMacros (bool) : an input.bool() or simple bool to determine whether to activate the function
noBorders (bool) : an input.bool() to determine whether the box anchored to the session should have borders
Returns: void
po3(tf, left, right, show)
use to calculate HTF po3 candle
@tip only call this function on "barstate.islast"
Parameters:
tf (simple string)
left (int) : the left point of the candle, calculated as bar_index + left,
right (int) : :the right point of the candle, calculated as bar_index + right,
show (bool) : input.bool() whether to show the po3 candle or not
Returns: void
silverBullet(silverBulletStratLong, silverBulletStratShort, future, userTF, H, L, H2, L2, noBorders, silverBulletLongTP, historicalPoints, historicalData, silverBulletLongSL, silverBulletShortTP, silverBulletShortSL)
used to execute the Silver Bullet Strategy
Parameters:
silverBulletStratLong (simple bool)
silverBulletStratShort (simple bool)
future (int) : a future time, used for drawings, example "last_bar_time"
userTF (simple int)
H (float) : the high price of the user-selected TF
L (float) : the low price of the user-selected TF
H2 (float) : the high price of the user-selected TF
L2 (float) : the low price of the user-selected TF
noBorders (bool) : an input.bool() used to remove the borders from box drawings
silverBulletLongTP (series silverBulletLevels)
historicalPoints (array)
historicalData (necessaryData)
silverBulletLongSL (series silverBulletLevels)
silverBulletShortTP (series silverBulletLevels)
silverBulletShortSL (series silverBulletLevels)
Returns: void
method invalidFVGcheck(FVGarr, upFVGpricesSorted, dnFVGpricesSorted)
check if existing FVGs are still valid
Namespace types: array
Parameters:
FVGarr (array)
upFVGpricesSorted (array) : an array of bullish FVG prices, used to selective search through FVG array to remove invalidated levels
dnFVGpricesSorted (array) : an array of bearish FVG prices, used to selective search through FVG array to remove invalidated levels
Returns: void (0)
method drawFVG(counter, FVGshow, FVGname, FVGcol, data, masterCoords, labelLevels, borderTransp, liteMode, rightCoordinate)
draws FVGs on last bar
Namespace types: map
Parameters:
counter (map) : a counter, as map, keeping count of the number of FVGs drawn, makes sure that there aren't more FVGs drawn
than int FVGshow
FVGshow (int) : the number of FVGs to show. There should be a bullish FVG show and bearish FVG show. This function "drawFVG" is used separately
for bearish FVG and bullish FVG.
FVGname (string) : the name of the FVG, "FVG Up" or "FVG Down"
FVGcol (color) : desired FVG color
data (FVG)
masterCoords (map) : a map containing the names and price points of key levels. Used to define price ranges.
labelLevels (string) : an input.string with options "Inside", "Outside", "Remove". Determines whether FVG labels should be inside box, outside,
or na.
borderTransp (int)
liteMode (bool)
rightCoordinate (int) : the right coordinate of any drawings. Must be a time point.
Returns: void
invalidBlockCheck(bullishOBbox, bearishOBbox, userTF)
check if existing order blocks are still valid
Parameters:
bullishOBbox (array) : an array declared using the UDT orderBlock that contains bullish order block related data
bearishOBbox (array) : an array declared using the UDT orderBlock that contains bearish order block related data
userTF (simple int)
Returns: void (0)
method lastBarRejections(id, rejectionColor, idShow, rejectionString, labelLevels, borderTransp, liteMode, rightCoordinate, masterCoords)
draws rejectionBlocks on last bar
Namespace types: array
Parameters:
id (array) : the array, an array of rejection block data declared using the UDT rejection block
rejectionColor (color) : the desired color of the rejection box
idShow (int)
rejectionString (string) : the desired name of the rejection blocks
labelLevels (string) : an input.string() to determine if labels for the block should be inside the box, outside, or none.
borderTransp (int)
liteMode (bool) : an input.bool(). True = neon effect, false = no neon.
rightCoordinate (int) : atime for the right coordinate of the box
masterCoords (map) : a map that stores the price of key levels and assigns them a name, used to determine price ranges
Returns: void
method OBdraw(id, OBshow, BBshow, OBcol, BBcol, bullishString, bearishString, isBullish, labelLevels, borderTransp, liteMode, rightCoordinate, masterCoords)
draws orderblocks and breaker blocks for data stored in UDT array()
Namespace types: array
Parameters:
id (array) : the array, an array of order block data declared using the UDT orderblock
OBshow (int) : the number of order blocks to show
BBshow (int) : the number of breaker blocks to show
OBcol (color) : color of order blocks
BBcol (color) : color of breaker blocks
bullishString (string) : the title of bullish blocks, which is a regular bullish orderblock or a bearish orderblock that's converted to breakerblock
bearishString (string) : the title of bearish blocks, which is a regular bearish orderblock or a bullish orderblock that's converted to breakerblock
isBullish (bool) : whether the array contains bullish orderblocks or bearish orderblocks. If bullish orderblocks,
the array will naturally contain bearish BB, and if bearish OB, the array will naturally contain bullish BB
labelLevels (string) : an input.string() to determine if labels for the block should be inside the box, outside, or none.
borderTransp (int)
liteMode (bool) : an input.bool(). True = neon effect, false = no neon.
rightCoordinate (int) : atime for the right coordinate of the box
masterCoords (map) : a map that stores the price of key levels and assigns them a name, used to determine price ranges
Returns: void
FVG
UDT for FVG calcualtions
Fields:
H (series float) : high price of user-selected timeframe
L (series float) : low price of user-selected timeframe
direction (series string) : FVG direction => "Up" or "Down"
T (series int) : => time of bar on user-selected timeframe where FVG was created
fvgLabel (series label) : optional label for FVG
fvgLineTop (series line) : optional line for top of FVG
fvgLineBot (series line) : optional line for bottom of FVG
fvgBox (series box) : optional box for FVG
labelLine
quickly pair a line and label together as UDT
Fields:
lin (series line) : Line you wish to pair with label
lab (series label) : Label you wish to pair with line
orderBlock
UDT for order block calculations
Fields:
orderBlockData (array) : array containing order block x and y points
orderBlockBox (series box) : optional order block box
vioCount (series int) : = 0 violation count of the order block. 0 = Order Block, 1 = Breaker Block
traded (series bool)
status (series string) : = "OB" status == "OB" => Level is order block. status == "BB" => Level is breaker block.
orderBlockLab (series label) : options label for the order block / breaker block.
strongPoints
UDT for strong highs and strong lows
Fields:
price (series float) : price of the strong high or strong low
timeAtprice (series int) : time of the strong high or strong low
strongPointLabel (series label) : optional label for strong point
strongPointLine (series line) : optional line for strong point
overlayLine (series line) : optional lines for strong point to enhance visibility
overlayLine2 (series line) : optional lines for strong point to enhance visibility
displacement
UDT for dispacements
Fields:
highPrice (series float) : high price of displacement
lowPrice (series float) : low price of displacement
timeAtPrice (series int) : time of bar where displacement occurred
displacementBox (series box) : optional box to draw displacement
displacementLab (series label) : optional label for displacement
po3data
UDT for po3 calculations
Fields:
dHigh (series float) : higher timeframe high price
dLow (series float) : higher timeframe low price
dOpen (series float) : higher timeframe open price
dClose (series float) : higher timeframe close price
po3box (series box) : box to draw po3 candle body
po3line (array) : line array to draw po3 wicks
po3Labels (array) : label array to label price points of po3 candle
macros
UDT for session macros
Fields:
sessions (array) : Array of sessions, you can populate this array using the "quickTime" function located above "export macros".
prices (matrix) : Matrix of session data -> open, high, low, close, time
sessionTimes (array) : Array of session names. Pairs with array sessions.
sessionLines (matrix) : Optional array for sesion drawings.
OTEtimes
UDT for data storage and drawings associated with OTE strategy
Fields:
upTimes (array) : time of highest point before trade is taken
dnTimes (array) : time of lowest point before trade is taken
tpLineLong (series line) : line to mark tp level long
tpLabelLong (series label) : label to mark tp level long
slLineLong (series line) : line to mark sl level long
slLabelLong (series label) : label to mark sl level long
tpLineShort (series line) : line to mark tp level short
tpLabelShort (series label) : label to mark tp level short
slLineShort (series line) : line to mark sl level short
slLabelShort (series label) : label to mark sl level short
sweeps
UDT for data storage and drawings associated with liquidity sweeps
Fields:
upSweeps (matrix) : matrix containing liquidity sweep price points and time points for up sweeps
dnSweeps (matrix) : matrix containing liquidity sweep price points and time points for down sweeps
upSweepDrawings (array) : optional up sweep box array. Pair the size of this array with the rows or columns,
dnSweepDrawings (array) : optional up sweep box array. Pair the size of this array with the rows or columns,
raidExitDrawings
UDT for drawings associated with the Liquidity Raid Strategy
Fields:
tpLine (series line) : tp line for the liquidity raid entry
tpLabel (series label) : tp label for the liquidity raid entry
slLine (series line) : sl line for the liquidity raid entry
slLabel (series label) : sl label for the liquidity raid entry
m2022
UDT for data storage and drawings associated with the Model 2022 Strategy
Fields:
mTime (series int) : time of the FVG where entry limit order is placed
mIndex (series int) : array index of FVG where entry limit order is placed. This requires an array of FVG data, which is defined above.
mEntryDistance (series float) : the distance of the FVG to the 50% range. M2022 looks for the fvg closest to 50% mark of range.
mEntry (series float) : the entry price for the most eligible fvg
fvgHigh (series float) : the high point of the eligible fvg
fvgLow (series float) : the low point of the eligible fvg
longFVGentryBox (series box) : long FVG box, used to draw the eligible FVG
shortFVGentryBox (series box) : short FVG box, used to draw the eligible FVG
line50P (series line) : line used to mark 50% of the range
line100P (series line) : line used to mark 100% (top) of the range
line0P (series line) : line used to mark 0% (bottom) of the range
label50P (series label) : label used to mark 50% of the range
label100P (series label) : label used to mark 100% (top) of the range
label0P (series label) : label used to mark 0% (bottom) of the range
sweepData (array)
silverBullet
UDT for data storage and drawings associated with the Silver Bullet Strategy
Fields:
session (series bool)
sessionStr (series string) : name of the session for silver bullet
sessionBias (series string)
sessionHigh (series float) : = high high of session // use math.max(silverBullet.sessionHigh, high)
sessionLow (series float) : = low low of session // use math.min(silverBullet.sessionLow, low)
sessionFVG (series float) : if applicable, the FVG created during the session
sessionFVGdraw (series box) : if applicable, draw the FVG created during the session
traded (series bool)
tp (series float) : tp of trade entered at the session FVG
sl (series float) : sl of trade entered at the session FVG
sessionDraw (series box) : optional draw session with box
sessionDrawLabel (series label) : optional label session with label
silverBulletDrawings
UDT for trade exit drawings associated with the Silver Bullet Strategy
Fields:
tpLine (series line) : tp line drawing for strategy
tpLabel (series label) : tp label drawing for strategy
slLine (series line) : sl line drawing for strategy
slLabel (series label) : sl label drawing for strategy
unicornModel
UDT for data storage and drawings associated with the Unicorn Model Strategy
Fields:
hPoint (chart.point)
hPoint2 (chart.point)
hPoint3 (chart.point)
breakerBlock (series box) : used to draw the breaker block required for the Unicorn Model
FVG (series box) : used to draw the FVG required for the Unicorn model
topBlock (series float) : price of top of breaker block, can be used to detail trade entry
botBlock (series float) : price of bottom of breaker block, can be used to detail trade entry
startBlock (series int) : start time of the breaker block, used to set the "left = " param for the box
includes (array) : used to store the time of the breaker block, or FVG, or the chart point sequence that setup the Unicorn Model.
entry (series float) : // eligible entry price, for longs"math.max(topBlock, FVG.get_top())",
tpLine (series line) : optional line to mark PT
tpLabel (series label) : optional label to mark PT
slLine (series line) : optional line to mark SL
slLabel (series label) : optional label to mark SL
rejectionBlocks
UDT for data storage and drawings associated with rejection blocks
Fields:
rejectionPoint (chart.point)
bodyPrice (series float) : candle body price closest to the rejection point, for "Up" rejections => math.max(open, close),
rejectionBox (series box) : optional box drawing of the rejection block
rejectionLabel (series label) : optional label for the rejection block
equalLevelsDraw
UDT for data storage and drawings associated with equal highs / equal lows
Fields:
connector (series line) : single line placed at the first high or low, y = avgerage of distinguished equal highs/lows
connectorLab (series label) : optional label to be placed at the highs or lows
levels (array) : array containing the equal highs or lows prices
times (array) : array containing the equal highs or lows individual times
startTime (series int) : the time of the first high or low that forms a sequence of equal highs or lows
radiate (array) : options label to "radiate" the label in connector lab. Can be used for anything
necessaryData
UDT for data storage of historical price points.
Fields:
highArr (array) : array containing historical high points
lowArr (array) : array containing historical low points
timeArr (array) : array containing historical time points
logArr (array) : array containing historical log returns
signArr (array) : array containing historical price directions
closeArr (array) : array containing historical close points
binaryTimeArr (array) : array containing historical time points, uses "push" instead of "unshift" to allow for binary search
binaryCloseArr (array) : array containing historical close points, uses "push" instead of "unshift" to allow the correct
binaryOpenArr (array) : array containing historical optn points, uses "push" instead of "unshift" to allow the correct
atrTFarr (array) : array containing historical user-selected TF atr points
openArr (array) : array containing historical open points
Supply and demandHi all!
This is my take on supply/demand. The gist is that it creates a zone if there is a big enough reaction. This is configurable in settings as "Minimum range (ATR factor)" (the Average True Length of length 14) that is the distance that the price must travel and "Reaction bars" that is the maximum number of bars that price must travel this distance. The zones that are shown are the ones that have a retest, break and retest or is unmitigated (untouched). If a zone is mitigated (entered) or broken it is temporarily hidden. For a zone to be created it needs to have this reaction and the previous bar does not.
So this script will show you zones that are fresh (unmitigated), retested or broken and retested. This means that the zones that are shown have "proven" that they are good zones through this. Basically it means that the script creates a bunch of zones and then picks the good once. This makes the script have some latency, but will hopefully give you good zones. A zone is completely removed if it's broken twice (it's okay if it's broken once and can still have a retest after it has flipped from previous supply (or resistance) into demand (or support)).
Here is a zone (the one that has the lowest opacity) that is broken and retested that could have resulted in a good long trade (the settings are default but has a stop in the beginning of 2024):
You have a setting to remove zones that are pierced (broken by price wicks). The following zone is pierced by price (in the beginning of May) that will not be shown after the start of May if you have "Pierced" checked (the indicator has default settings but a stop in the middle of April):
You have a trend section. Zones that create a reaction upwards can only be created if the trend is considered to be up, and vice versa. The options here are "SMA50" (the current price needs to be over the Simple Moving Average of length 50) and "SMA50, SMA200" (price needs to be over the Simple Moving Average of length 50 and the Simple Moving Average of length 50 needs to be over the Simple Moving Average of length 200). If these conditions are met the trend is considered to be up, otherwise it's down. You can disable this by choosing "No detection".
The zones that are shown also need to be within a limit (of the current price). This limit is 10 (factor of the Average True Range if length 14) by default. Set this to 0 to deactivate. This is useful for not showing zones that are far away from current price and therefore unlikely to be interacted with.
You can stop the calculation of zones (through the "Stop" value in the settings). This is useful to see if previous zones were any good. I used it in my testing of the script but left it because it can be nice to have.
The zones created by the script have different transparency based upon the zone's interaction. The clearest zones are the ones that are unmitigated, the second clearest ones are the ones having a retest and lastly the zones which are most unclear are the ones having a break and then a retest.
You can see the concept of this script to be a mix of supply/demand and support/resistance, having zones being unmitigated (untouched) as the most important but also show the zones having an interaction (in the form of a retest or a break and retest).
This is from a previous supply (or resistance) zone that has flipped into demand (or support) and has shown to be a good zone through a retest followed by a rally (default settings):
This zone has multiple retest and then rallies that could have given a good long trades (it has the default settings but a "Stop" time at 2022-01-14):
TODO:
- Create zones based on pivots
- Handle overlapping zones
- Incorporate volume in the creation and/or interaction with zones
- Add alerts
- Add ability to set maximum zone width
- Add ability to set the maximum number of retest bars
- ...?
The example for this publication has the default settings bit a "Stop" and a tighter "Limit" of 4.
I hope this explanation makes sense, let me know otherwise. Also let me know if you have any suggestions on improvements.
Best of trading luck!