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:
Göstergeler ve stratejiler
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!
Earnings Surprise Indicator (Post-Earnings Announcement Drift)What It Does:
- Displays a company's actual earnings vs. analysts' estimates over time
- Shows "earnings surprises" - when actual results beat or miss expectations
- Helps identify trends in a company's financial performance
How It Works:
- Green bars: Positive surprise (earnings beat estimates)
- Red bars: Negative surprise (earnings missed estimates)
- Yellow line: Analysts' earnings estimates
Correlation with Post Earnings Announcement Drift (PEAD): PEAD is the tendency for a stock's price to drift in the direction of an earnings surprise for several weeks or months after the announcement.
Why It Matters:
- Positive surprises often lead to upward price drift
- Negative surprises often lead to downward price drift
- This drift can create trading opportunities
How to Use It:
1. Spot Trends:
- Consistent beats may indicate strong company performance
- Consistent misses may signal underlying issues
2. Gauge Market Expectations:
- Large surprises may lead to significant price movements
3. Timing Decisions:
- Consider long positions after positive surprises
- Consider short positions or exits after negative surprises
4. Risk Management:
- Be cautious of reversal if the drift seems excessive
- Use in conjunction with other technical and fundamental analysis
Key Takeaways:
- Earnings surprises can be fundamental-leading indicators of future stock performance, especially when correlated with analyst projections
- PEAD suggests that markets often underreact to earnings news initially
- This indicator helps visualize the magnitude and direction of surprises
- It can be a valuable tool for timing entry and exit points in trades
Savitzky Golay Median Filtered RSI [BackQuant]Savitzky Golay Median Filtered RSI
Introducing BackQuant's Savitzky Golay Median Filtered RSI, a cutting-edge indicator that enhances the classic Relative Strength Index (RSI) by applying both a Savitzky-Golay filter and a median filter to provide smoother and more reliable signals. This advanced approach helps reduce noise and captures true momentum trends with greater precision. Let’s break down how the indicator works, the features it offers, and how it can improve your trading strategy.
Core Concept: Relative Strength Index (RSI)
The Relative Strength Index (RSI) is a widely used momentum oscillator that measures the speed and change of price movements. It oscillates between 0 and 100, with levels above 70 typically indicating overbought conditions and levels below 30 indicating oversold conditions. However, the standard RSI can sometimes generate noisy signals, especially in volatile markets, making it challenging to identify reliable entry and exit points.
To improve upon the traditional RSI, this indicator introduces two powerful filters: the Savitzky-Golay filter and a median filter.
Savitzky-Golay Filter: Smoothing with Precision
The Savitzky-Golay filter is a digital filtering technique used to smooth data while preserving important features, such as peaks and trends. Unlike simple moving averages that can distort important price data, the Savitzky-Golay filter uses polynomial regression to fit the data, providing a more accurate and less lagging result.
In this script, the Savitzky-Golay filter is applied to the RSI values to smooth out short-term fluctuations and provide a more reliable signal. By using a window size of 5 and a polynomial degree of 2, the filter effectively reduces noise without compromising the integrity of the underlying price movements.
Median Filter: Reducing Outliers
After applying the Savitzky-Golay filter, the median filter is applied to the smoothed RSI values. The median filter is particularly effective at removing short-lived outliers, further enhancing the accuracy of the RSI by reducing the impact of sudden and temporary price spikes or drops. This combination of filters creates an ultra-smooth RSI that is better suited for detecting true market trends.
Long and Short Signals
The Savitzky Golay Median Filtered RSI generates long and short signals based on user-defined threshold levels:
Long Signals: A long signal is triggered when the filtered RSI exceeds the Long Threshold (default set at 176). This indicates that momentum is shifting upward, and it may present a good buying opportunity.
Short Signals: A short signal is generated when the filtered RSI falls below the Short Threshold (default set at 162). This suggests that momentum is weakening, potentially signaling a selling opportunity or exit from a long position.
These threshold levels can be adjusted to suit different market conditions and timeframes, allowing traders to fine-tune the sensitivity of the indicator.
Customization and Visualization Options
The Savitzky Golay Median Filtered RSI comes with several customization options, enabling traders to tailor the indicator to their specific needs:
Calculation Source: Select the price source for the RSI calculation (default is OHLC4, but it can be changed to close, open, high, or low prices).
RSI Period: Adjust the lookback period for the RSI calculation (default is 14).
Median Filter Length: Control the length of the median filter applied to the smoothed RSI, affecting how much noise is removed from the signal.
Threshold Levels: Customize the long and short thresholds to define the sensitivity for generating buy and sell signals.
UI Settings: Choose whether to display the RSI and thresholds on the chart, color the bars according to trend direction, and adjust the line width and colors used for long and short signals.
Visual Feedback: Color-Coded Signals and Thresholds
To make the signals easier to interpret, the indicator offers visual feedback by coloring the price bars and the RSI plot according to the current market trend:
Green Bars indicate long signals when momentum is bullish.
Red Bars indicate short signals when momentum is bearish.
Gray Bars indicate neutral or undecided conditions when no clear signal is present.
In addition, the Long and Short Thresholds can be plotted directly on the chart to provide a clear reference for when signals are triggered, allowing traders to visually gauge the strength of the RSI relative to its thresholds.
Alerts for Automation
For traders who prefer automated notifications, the Savitzky Golay Median Filtered RSI includes built-in alert conditions for long and short signals. You can configure these alerts to notify you when a buy or sell condition is met, ensuring you never miss a trading opportunity.
Trading Applications
This indicator is versatile and can be used in a variety of trading strategies:
Trend Following: The combination of Savitzky-Golay and median filtering makes this RSI particularly useful for identifying strong trends without being misled by short-term noise. Traders can use the long and short signals to enter trades in the direction of the prevailing trend.
Reversal Trading: By adjusting the threshold levels, traders can use this indicator to spot potential reversals. When the RSI moves from overbought to oversold levels (or vice versa), it may signal a shift in market direction.
Swing Trading: The smoothed RSI provides a clear signal for short to medium-term price movements, making it an excellent tool for swing traders looking to capitalize on momentum shifts.
Risk Management: The filtered RSI can be used as part of a broader risk management strategy, helping traders avoid false signals and stay in trades only when the momentum is strong.
Final Thoughts
The Savitzky Golay Median Filtered RSI takes the classic RSI to the next level by applying advanced smoothing techniques that reduce noise and improve signal reliability. Whether you’re a trend follower, swing trader, or reversal trader, this indicator provides a more refined approach to momentum analysis, helping you make better-informed trading decisions.
As with all indicators, it is important to backtest thoroughly and incorporate sound risk management strategies when using the Savitzky Golay Median Filtered RSI in your trading system.
Thus following all of the key points here are some sample backtests on the 1D Chart
Disclaimer: Backtests are based off past results, and are not indicative of the future.
INDEX:BTCUSD
INDEX:ETHUSD
BINANCE:SOLUSD
Big Volume Highlighter ADVANCEDBIG VOLUME HIGHLIGHTER INDICATOR ADVANCED
The BIG VOLUME INDICATOR ADVANCED is an essential tool for traders who want to gain a deeper understanding of market dynamics through volume analysis. This advanced indicator highlights significant volume spikes, enabling traders to make more informed decisions based on market activity and price movements.
Key Features:
Customizable Lookback Period: Define the number of candles over which the highest volume is calculated, allowing you to adjust the analysis to fit your specific trading strategy and timeframe.
Approximate Volume Matching: Activate the approximate volume matching feature to identify candles that fall within a specified range of a target volume. This feature is particularly valuable for capturing notable volume spikes that may not match your exact input but are within an acceptable tolerance.
Flexible Volume Units: Input volumes in various units (Hundreds, Thousands, Millions, or Billions) to cater to your trading preferences. This flexibility ensures that you can analyze volume data in a way that aligns with your trading style.
Dynamic Tolerance Calculation: Set a percentage-based tolerance for volume matching, allowing for greater flexibility. For instance, if you input a volume of 600 million with a tolerance of 1.5%, the indicator will highlight candles with volumes ranging from 591 million to 609 million.
Visual Alerts: Highlighted candles are marked with clear, color-coded labels positioned above the bars. Green labels represent bullish candles, while red labels denote bearish candles, providing immediate visual feedback on market sentiment.
Mobile and Desktop Compatibility: Designed for seamless integration with TradingView, this indicator is accessible on both desktop and mobile devices, ensuring that you can monitor the market wherever you are.
How to Use:
Set the Lookback Period: Adjust the lookback period to analyze a specific number of candles for volume spikes.
Enable Approximate Volume Matching: If desired, toggle the approximate volume matching feature and enter your target volume, selecting the appropriate unit.
Adjust Tolerance: Define the tolerance percentage to specify how close the volume must be to your input for it to be considered significant.
Analyze the Chart: Observe the highlighted candles on your chart, which indicate significant volume activity based on your criteria.
Make Informed Decisions: Leverage the insights provided by the indicator to guide your trading decisions, identifying potential entry or exit points based on volume analysis.
****
Kalman For Loop [BackQuant]Kalman For Loop
Introducing BackQuant's Kalman For Loop (Kalman FL) — a highly adaptive trading indicator that uses a Kalman filter to smooth price data and generate actionable long and short signals. This advanced indicator is designed to help traders identify trends, filter out market noise, and optimize their entry and exit points with precision. Let’s explore how this indicator works, its key features, and how it can enhance your trading strategies.
Core Concept: Kalman Filter
The Kalman Filter is a mathematical algorithm used to estimate the state of a system by filtering noisy data. It is widely used in areas such as control systems, signal processing, and time-series analysis. In the context of trading, a Kalman filter can be applied to price data to smooth out short-term fluctuations, providing a clearer view of the underlying trend.
Unlike moving averages, which use fixed weights to smooth data, the Kalman Filter adjusts its estimate dynamically based on the relationship between the process noise and the measurement noise. This makes the filter more adaptive to changing market conditions, providing more accurate trend detection without the lag associated with traditional smoothing techniques.
Please see the original Kalman Price Filter
In this script, the Kalman For Loop applies the Kalman filter to the price source (default set to the closing price) to generate a smoothed price series, which is then used to calculate signals.
Adaptive Smoothing with Process and Measurement Noise
Two key parameters govern the behavior of the Kalman filter:
Process Noise: This controls the extent to which the model allows for uncertainty in price changes. A lower process noise value will make the filter smoother but slower to react to price changes, while a higher value makes it more sensitive to recent price fluctuations.
Measurement Noise: This represents the uncertainty or "noise" in the observed price data. A higher measurement noise value gives the filter more leeway to ignore short-term fluctuations, focusing on the broader trend. Lowering the measurement noise makes the filter more responsive to minor changes in price.
These settings allow traders to fine-tune the Kalman filter’s sensitivity, adjusting it to match their preferred trading style or market conditions.
For-Loop Scoring Mechanism
The Kalman FL further enhances the effectiveness of the Kalman filter by using a for-loop scoring system. This mechanism evaluates the smoothed price over a range of periods (defined by the Calculation Start and Calculation End inputs), assigning a score based on whether the current filtered price is higher or lower than previous values.
Long Signals: A long signal is generated when the for-loop score surpasses the Long Threshold (default set at 20), indicating a strong upward trend. This helps traders identify potential buying opportunities.
Short Signals: A short signal is triggered when the score crosses below the Short Threshold (default set at -10), signaling a potential downtrend or selling opportunity.
These signals are plotted on the chart, giving traders a clear visual indication of when to enter long or short positions.
Customization and Visualization Options
The Kalman For Loop comes with a range of customization options to give traders full control over how the indicator operates and is displayed on the chart:
Kalman Price Source: Choose the price data used for the Kalman filter (default is the closing price), allowing you to apply the filter to other price points like open, high, or low.
Filter Order: Set the order of the Kalman filter (default is 5), controlling how far back the filter looks in its calculations.
Process and Measurement Noise: Fine-tune the sensitivity of the Kalman filter by adjusting these noise parameters.
Signal Line Width and Colors: Customize the appearance of the signal line and the colors used to indicate long and short conditions.
Threshold Lines: Toggle the display of the long and short threshold lines on the chart for better visual clarity.
The indicator also includes the option to color the candlesticks based on the current trend direction, allowing traders to quickly identify changes in market sentiment. In addition, a background color feature further highlights the overall trend by shading the background in green for long signals and red for short signals.
Trading Applications
The Kalman For Loop is a versatile tool that can be adapted to a variety of trading strategies and markets. Some of the primary use cases include:
Trend Following: The adaptive nature of the Kalman filter helps traders identify the start of new trends with greater precision. The for-loop scoring system quantifies the strength of the trend, making it easier to stay in trades for longer when the trend remains strong.
Mean Reversion: For traders looking to capitalize on short-term reversals, the Kalman filter's ability to smooth price data makes it easier to spot when price has deviated too far from its expected path, potentially signaling a reversal.
Noise Reduction: The Kalman filter excels at filtering out short-term price noise, allowing traders to focus on the broader market movements without being distracted by minor fluctuations.
Risk Management: By providing clear long and short signals based on filtered price data, the Kalman FL helps traders manage risk by entering positions only when the trend is well-defined, reducing the chances of false signals.
Alerts and Automation
To further assist traders, the Kalman For Loop includes built-in alert conditions that notify you when a long or short signal is generated. These alerts can be configured to trigger notifications, helping you stay on top of market movements without constantly monitoring the chart.
Final Thoughts
The Kalman For Loop is a powerful and adaptive trading indicator that combines the precision of the Kalman filter with a for-loop scoring mechanism to generate reliable long and short signals. Whether you’re a trend follower or a reversal trader, this indicator offers the flexibility and accuracy needed to navigate complex markets with confidence.
As always, it’s important to backtest the indicator and adjust the settings to fit your trading style and market conditions. No indicator is perfect, and the Kalman FL should be used alongside other tools and sound risk management practices for the best results.
Enhanced Kelly Criterion with Risk ManagementThis script is a trading tool for risk management and position size calculations based on the Kelly criteria. The objective is to calculate the optimal position size for each trade based on win/loss ratio and win/loss ratio to manage your money.
Overview
Initial Funding: Starting with an initial capital of $10,000, the balance (amount of funds) of both “bullish” and “bearish” positions will increase or decrease depending on the outcome of the trade.
Risk Management: Users can set their risk tolerance from 1-100%. In addition, the maximum position size per trade is also limited at 50%, for example. This setting allows the user to limit risk.
Record of trade results: For each trade, a positive (bullish) or negative (bearish) line is determined, and wins and losses are recorded accordingly. Win/loss ratios and win/loss ratios are also calculated in real time from this data.
Win rate: Calculates the percentage of winning trades in a trade.
Win/Loss Ratio: Calculates the ratio of profit/loss between positive and negative trades.
Position sizing using the Kelly Criterion: Based on the win/loss ratio, the optimal position size to take on the next trade is calculated using the Kelly Criterion. However, this Kelly Criterion is treated with caution because of the potential for increased risk.
Controlling Risk and Position Size
Volatility adjustment using ATR (Average True Range): The script considers market volatility (range of price fluctuation) using a measure called ATR. This allows for smaller position sizes when price volatility is high, thereby reducing risk.
Position Size Limit: The maximum position size is limited so that the calculated position size does not exceed a certain range. This reduces the risk of large losses.
Display of Results
The script visually plots the final position size and amount of funds so that traders can see the changes in balance. To highlight points of change, position size expansions and contractions are shown, allowing traders to catch signs of sudden fluctuations or changes in volatility.
Suggested Improvements and Considerations
Kelly Criteria Overexposure Risk: Calculations based on the Kelly Criteria are theoretically correct, but they tend to take large positions. This can be very damaging in the event of losses. Therefore, while this script limits risk by setting a maximum position size, it is recommended that you adjust to an even more modest position size.
Data Reliability: The calculation of win/loss ratios and win/loss ratios relies on historical trade data, which can be unreliable until sufficient trade data is gathered. When trade data is scarce, calculations based on the Kelly Criteria may be overly optimistic.
Volatility considerations: Volatility adjustment using ATR is effective, but ATR alone may not be sufficient when markets fluctuate rapidly; if ATR adjustment is insufficient, additional risk mitigation techniques should be used in conjunction.
Overall, this script emphasizes risk management and optimizes position size using the Kelly criteria, but real market conditions require careful risk management with attention to overexposure.
ATR Trailing Stop by tactical trade 22 Oct 2024Description:
The ATR Dual Trailing Stop indicator is a versatile and powerful tool designed to help traders visualize dynamic support and resistance levels based on the Average True Range (ATR). This indicator plots two separate ATR-based trailing stops with customizable settings, providing a comprehensive view of potential market reversals and trend strength.
Key features:
Two ATR Trailing Stops: The first stop uses customizable ATR settings (default: 10-period ATR with a 3x multiplier), while the second stop uses an alternate configuration (default: 21-period ATR with a 7x multiplier).
Multi-Timeframe ATR Calculation: Regardless of the chart's time frame, the ATR is calculated based on a user-selected time frame (e.g., daily), allowing for consistent stop-loss levels even in lower time frames like 5-minute or 15-minute charts.
Visual Cues: The indicator clearly plots two trailing stop lines in different colors, making it easy to track the market’s volatility-based support and resistance areas.
No Buy/Sell Signals: This is purely a trailing stop indicator with no embedded buy/sell signals, giving traders the flexibility to use it with their preferred entry/exit strategies.
This indicator is especially useful in highly volatile markets where precise trailing stop levels are essential for managing risk and maximizing profit potential. The dual ATR configuration helps traders adapt to changing market conditions by providing two levels of stop placement: a shorter-term and a longer-term trailing stop.
SMI Ergodic Indicator/Oscillator▮ Introduction
The Stochastic Momentum Index Ergodic Indicator (SMII) is a technical analysis tool designed to predict trend reversals in the price of an asset.
It functions as a momentum oscillator, measuring the ratio of the smoothed price change to the smoothed absolute price change over a given number of previous periods.
The Ergodic SMI is based on the True Strength Index (TSI) and integrates a signal line, which is an exponential moving average (EMA) of the SMI indicator itself.
It provides a clearer picture of market trends than the traditional stochastic oscillator by incorporating the concept of "ergodicity", which helps remove market noise.
On ther other hand, the Stochastic Momentum Index Ergodic Oscillator (SMIO) is a histogram that measures the difference between TSI and it's signal line.
By default, in TradingView both SMII and SMIO are provided independently.
Here in this script these two indicators are combined, providing a more comprehensive view of price direction and market strength.
▮ Motivation: why another indicator?
The intrinsic value of this indicator lies in the fact that it allows fine adjustments in both calculation parameters, data source and visualization, features that are not present in the standard indicators or similar.
Also, trend lines breakouts and divergences detector were added.
▮ What to look for
When using the indicator, there are a few things to look out for.
First, look at the SMI signal line.
When the line crosses above -40, it is considered a buy signal, while the crossing below +40 is considered a sell signal.
Also, pay attention to divergences between the SMI and the price.
If price is rising but the SMI is showing negative divergence, it could indicate that momentum is waning and a reversal could be in the offing.
Likewise, if price is falling but the SMI is showing positive divergence, this could indicate that momentum is building and a reversal could also be in the offing.
Divergences can be considered in both indicator and/or histogram.
Examples:
▮ Notes
The indicator presented here offers both the "SMII" and the "SMIO", that is, the "Stochastic Momentum Index Ergodic Indicator" together with the "Stochastic Momentum Index Ergodic Oscillator" (histogram), as per the documentation described in reference links.
So it is important to highlight the differences in relation to my other indicator, Stochastic Momentum Index (SMI) Refurbished .
This last one is purely based on the **SMI**, which is implemented using smoothed ratio between the relative range and the high/low range.
Although they may seem the same in some situations, the calculation is actually different. The TSI tends to be more responsive at the expense of being noisier, while the SMI tends to be smoother. Which of these two indicators is best depends on the situation, the context, and the analyst's personal preference.
Please refer to reference links to more info.
▮ References
SMI documentation
SMII documentation
SMIO documentation
Profitable Mondays & Losing FridaysHere's a Pine Script that marks profitable Mondays and losing Fridays for a given stock:
Explanation
Input Parameter: The script allows you to input the stock symbol, defaulting to SPX.
Daily Returns: It calculates the daily return based on the closing price.
Day Identification: It checks if the current day is Monday or Friday.
Conditions:
Profitable Mondays: Marks with a green background if Monday's return is positive.
Losing Fridays: Marks with a red background if Friday's return is negative.
Visualization: Uses bgcolor to highlight the respective days on the chart.
You can adjust the stockSymbol input to analyze different stocks.
Price Action All In OneThis indicator represents the most advanced level of price action indicators, incorporating six useful features: traditional gaps, shadow gaps, bar counting, moving averages, previous values, and IO pattern matching .
When I refer to price action, I mean the teachings of Dr. Al Brooks.
While you can find these features in other indicators, mine is more advanced. The default settings are designed to work on a 5-minute timeframe, but you can also use this indicator on other time periods if you prefer.
Gaps
Traditional Gaps: Occurs when the lowest price of a bar is higher than the highest price of the previous bar, or the highest price of a bar is lower than the lowest price of the previous bar.
Shadow/Tail Gaps: Occurs when the lowest price of a bar is higher than the highest price of the second last bar, or the highest price of a bar is lower than the lowest price of the second last bar.
Gaps indicate strength, and consecutive gaps in one direction are characteristic of a strong trend. They offer a perspective on the strength of a trend, signifying that limit orders on one side are at a loss with no opportunity to exit at breakeven. Can bulls or bears create gaps? Are the gaps they create filled, or do they remain open?
Traditional Gaps & Shadow/Tail Gaps
Bar Counting
The ability to use different timeframes (e.g., to determine the minute within an hour or the hour within a week).
Consistent display of 1; in other indicators, if you set intervals to 2, you see 2, 4, 6, etc., or 1, 2, 4, 6. In my indicator, you will see 1, 3, 5, etc.
In intraday trading, certain specific times are more important than others. For example, a form of reversal is more likely to occur at the midpoint of the trading day (if there are 80 candles in a day, the midpoint is at the 40th candle).
This doesn't mean you should make reversal trades at the 40th candle. The bar count feature simply reminds you of the current time, helping you gauge how long until the trading day ends. For instance, if there are 80 candles in a day and you're an intraday trader, you probably shouldn't make a swing trade at the 70th candle because there are only 10 candles left until the close—likely not enough time for a swing to develop.
Additionally, if you trade on a 5-minute timeframe, seeing candles numbered 3, 6, 9, etc. indicates the close of a 15-minute candle. This means that in addition to 5-minute timeframe traders, 15-minute timeframe traders will also pay attention to these candles, making them more significant. For the same reason, the 12th candle is crucial, as its close also marks the close of an hourly candle.
Day Time Frame & Week Time Frame
Moving Averages
Provides three EMAs. You can set different timeframes and choose between continuous or discrete modes.
Moving averages are excellent tools for determining trends. The 20 EMA is particularly popular, which increases its significance. Traders using different timeframes, such as 5-minute, 15-minute, and 1-hour, all utilize the 20 EMA. This indicator allows you to see what traders on 15-minute and 1-hour timeframes are observing, even when you're on a 5-minute timeframe.
Once again, the default settings of this indicator assume that the user is trading intraday on a 5-minute timeframe. However, if that's not the case, you can easily adjust the moving average periods. For instance, if you trade on a 1-hour timeframe and want to display the 4-hour and daily moving averages on your chart, this can be done effortlessly.
5m 20, 15m 20 & 1h 20
Previous Values
Features three previous value displays. You can set their sources and timeframes independently and define the range for all previous values.
For intraday trading, marking the previous day's high, low, and close prices can be crucial. While some other indicators provide this feature, mine does it better. You can set different timeframes and choose various sources. For example, you might want to display the average of (O+H+L+C)/4 for the last week.
In addition to setting the timeframe and source, you can also configure the display range:
All: This will show the data in all positions. For example, you can see the high price from two days ago on yesterday's chart.
Today: This will only display the previous day's high price on the current day's chart.
Timeframe: This will display the data based on the specified timeframe you set.
Last Week High, Last Day Close & Low(Timeframe Display)
IO Pattern Matching
More advanced than other IO pattern matching indicators. For adjacent IIs, it merges to display as III, IIII, and so on. The same applies to OO patterns. Additionally, it automatically merges adjacent IOI and II into IOII, and adjacent OO and IOI into IIOI.
II Pattern: This refers to two consecutive inside bar candles. On a lower timeframe, the II pattern forms a converging triangle, which is a breakout pattern. The II pattern could also potentially become a final flag, which is the last flag in a trend.
OO Pattern: This refers to two consecutive outside bar candles. On a lower timeframe, the OO pattern forms an expanding triangle. You can use the OO pattern similarly to how you would use an expanding triangle.
IOI Pattern: This pattern occurs when the first candle is contained within the second candle, and the third candle is also contained within the second candle. This is a breakout pattern and could similarly represent a terminal flag in a trend.
The appearance of II, OO, or IOI patterns does not necessarily mean you should make a reversal trade. These patterns are meant to mark potential moves in a lower timeframe within the current cycle, providing a new perspective on the market and reminding you to stay vigilant.
You shouldn't look for IO patterns in a tight trading range. There are many IO patterns in a tight trading range, but they don't hold much significance.
II, OO & IOI
RSI Ignoring Gaps Between DaysThe RSI Ignoring Gaps Between Days indicator is an advanced modification of the traditional Relative Strength Index (RSI) designed to exclude price gaps that occur between the last bar of one trading day and the first bar of the next. This ensures that the RSI calculations remain focused on the actual price action during the trading session, avoiding distortions caused by overnight price gaps.
Key Features:
Gap Ignoring Mechanism: The indicator detects when a new day begins and skips the price change between the last bar of the previous day and the first bar of the current day. This ensures that only the intra-day price changes are included in the RSI calculation.
Intra-day Price Movement: The RSI calculations are based on real price changes within each trading day, providing a clearer reflection of momentum without interference from overnight events.
Dynamic RSI Calculation: The traditional RSI formula is preserved, but gains and losses are recalculated based on price changes from bar to bar within the same day.
Overbought/Oversold Levels: The indicator retains standard RSI overbought (70) and oversold (30) levels, allowing traders to easily identify potential reversal zones.
Alerts for Crossovers: Built-in alert conditions trigger when the RSI crosses key levels (30 or 70), signaling potential buying or selling opportunities.
This indicator is particularly useful for traders looking to focus on intra-day price action and avoid the influence of gaps caused by overnight market activity. It is suitable for intraday trading strategies where consistency in price movement measurement is crucial.
Stochastic RSI OHLC StrategyThe script titled "Stochastic RSI High Low Close Bars" is a versatile trading strategy implemented in Pine Script, designed for TradingView. Here's an overview of its features:
Description
This strategy leverages the Stochastic RSI to determine entry and exit signals in the market, focusing on high, low, and close values of the indicator. It incorporates various trading styles, stop-loss mechanisms, and multi-timeframe analysis to adapt to different market conditions.
Key Features
Stochastic RSI Analysis:
Uses the Stochastic RSI to identify potential entry points for long and short positions.
Tracks high, low, and close values for more granular analysis.
Multiple Trading Styles:
Supports diverse trading styles like Volume Color Swing, RSI Divergence, RSI Pullback, and more.
Allows switching between these styles to suit market dynamics.
Session-Based Trading:
Offers session control, limiting trades to specific hours (e.g., NY sessions).
Can close all positions at the end of the trading day.
Stop-Loss and Take-Profit Mechanisms:
Includes both static and dynamic stop-losses, with options for time-based stops, trailing stops, and momentum-based exits.
Customizable take-profit levels ensure efficient trade management.
Volume Analysis:
Integrates volume indicators to add a bias for trade entries and exits, enhancing signal reliability.
Multi-Timeframe Integration:
Employs multi-timeframe RSI analysis, allowing the strategy to capture broader trends and optimize entries.
This script is designed to provide flexibility and adaptability, making it useful for different trading strategies and market conditions. It is suitable for traders looking to refine their entries and exits with a focus on the Stochastic RSI.
AndreundCristianIndicator Overview:
The "Trade Signals with Volume" indicator is a custom script that generates buy and sell signals based on the crossover of two moving averages (a fast one and a slow one) and adds a volume filter to validate these signals. It plots these signals directly on the chart, using arrows or labels to indicate where buy and sell signals occur.
Key Features:
Moving Averages (MA):
The indicator uses two Simple Moving Averages (SMA): a fast SMA and a slow SMA.
A buy signal is triggered when the fast MA crosses above the slow MA, signaling potential bullish momentum.
A sell signal is triggered when the fast MA crosses below the slow MA, indicating potential bearish momentum.
Volume Filter:
To ensure that signals are more reliable, the indicator only triggers a buy or sell signal if the volume is above a certain threshold. This threshold can be adjusted by the user in the input settings.
For example, if the volume exceeds 100,000 (or any set value), and a crossover occurs, the signal is validated.
Visual Representation:
Buy signals are represented with green labels or arrows below the price bars.
Sell signals are represented with red labels or arrows above the price bars.
The MAs are also plotted on the chart for visual reference.
Input Parameters:
Fast Moving Average Length: The number of periods for the fast SMA (default is 9 periods).
Slow Moving Average Length: The number of periods for the slow SMA (default is 21 periods).
Volume Threshold: The minimum volume required to validate a buy or sell signal (default is 100,000).