TrendLine Toolkit w/ Breaks (Real-Time)The TrendLine Toolkit script introduces an innovating capability by extending the conventional use of trendlines beyond price action to include oscillators and other technical indicators. This tool allows traders to automatically detect and display trendlines on any TradingView built-in oscillator or community-built script, offering a versatile approach to trend analysis. With breakout detection and real-time alerts, this script enhances the way traders interpret trends in various indicators.
🔲 Methodology
Trendlines are a fundamental tool in technical analysis used to identify and visualize the direction and strength of a price trend. They are drawn by connecting two or more significant points on a price chart, typically the highs or lows of consecutive price movements (pivots).
Drawing Trendlines:
Uptrend Line - Connects a series of higher lows. It signals an upward price trend.
Downtrend Line - Connects a series of lower highs. It indicates a downward price trend.
Support and Resistance:
Support Line - A trendline drawn under rising prices, indicating a level where buying interest is historically strong.
Resistance Line - A trendline drawn above falling prices, showing a level where selling interest historically prevails.
Identification of Trends:
Uptrend - Prices making higher highs and higher lows.
Downtrend - Prices making lower highs and lower lows.
Sideways (or Range-bound) - Prices moving within a horizontal range.
A trendline helps confirm the existence and direction of a trend, providing guidance in aligning with the prevailing market sentiment. Additionally, they are usually paired with breakout analysis, a breakout occurs when the price breaches a trendline. This signals a potential change in trend direction or an acceleration of the existing trend.
The script adapts this methodology to oscillators and other indicators. Instead of relying on price pivots, which can only be detected in retrospect, the script utilizes a trailing stop on the oscillator to identify potential swings in real-time, you may find more info about it here (SuperTrend toolkit) . We detect swings or pivots simply by testing for crosses between the indicator and its trailing stop.
type oscillator
float o = Oscillator Value
float s = Trailing Stop Value
oscillator osc = oscillator.new()
bool l = ta.crossunder(osc.o, osc.s) => Utilized as a formed high
bool h = ta.crossover (osc.o, osc.s) => Utilized as a formed low
This approach enables the algorithm to detect trendlines between consecutive pivot highs or lows on the oscillator itself, providing a dynamic and immediate representation of trend dynamics.
🔲 Breakout Detection
The script goes beyond trendline creation by incorporating breakout detection directly within the oscillator. After identifying a trendline, the algorithm continuously monitors the oscillator for potential breakouts, signaling shifts in market sentiment.
🔲 Setup Guide
A simple example on one of my public scripts, Z-Score Heikin-Ashi Transformed
🔲 Settings
Source - Choose an oscillator source of which to base the Toolkit on.
Zeroing - The Mid-Line value of the oscillator, for example RSI & MFI use 50.
Sensitivity - Calibrates the Sensitivity of which TrendLines are detected, higher values result in more detections.
🔲 Alerts
Bearish TrendLine
Bullish TrendLine
Bearish Breakout
Bullish Breakout
As well as the option to trigger 'any alert' call.
By integrating trendline analysis into oscillators, this Toolkit enhances the capabilities of technical analysis, bringing a dynamic and comprehensive approach to identifying trends, support/resistance levels, and breakout signals across various indicators.
Toolkit
ICT Killzones Toolkit [LuxAlgo]The ICT Killzones Toolkit is a comprehensive set of tools designed to assist traders in identifying key trading zones and patterns within the market.
The ICT Killzones Toolkit includes the following Price Action components:
ICT Killzones with Pivot Highs/Lows
Order Blocks
Breaker Blocks
Fair Value Gaps
Market Structure Shifts
By combining these components, the ICT Killzones Toolkit provides traders with a comprehensive framework for analyzing the market and identifying setups of interest. Leveraging these tools effectively can enhance traders' decision-making process and improve killzones interpretability.
🔶 USAGE
In forex/futures trading, timing is crucial. ICT Killzone are specific periods when there's a higher chance of finding setups of interest. Mastering these time intervals can offer significant advantages to traders who know how to use them effectively.
The image above highlights a potential setup of interest when using the ICT Killzones Toolkit.
As another example for utilizing the ICT Killzones Toolkit, we can see in the image above when price retests setups generated from killzones such as Order Blocks or Fair Value Gaps, a potential strategy could be to look for entries on those & take profits as the next killzone appears.
🔹 Order Blocks
Order Blocks are sections on a price chart where notable buying or selling activity has occured, often signaling interest zones for institutional traders. This toolkit's Order Blocks component pinpoints these areas within the Killzone, which may act as potential support or resistance levels.
🔹 Breaker Blocks
Breaker Blocks are zones built from mitigated order blocks, and highlight zones on the chart where price has previously stalled or reversed. These areas may act as significant barriers to price movement in the future, and the Breaker Blocks component helps traders identify them for potential trading opportunities.
🔹 Fair Value Gaps
Fair value gaps are especially favored by price action traders and arise from market inefficiencies or imbalances, typically when buying and selling are unequal. These gaps often attract price movement before resuming in the same direction. the Fair Value Gaps component of the toolkit helps traders identify and analyze them.
🔹 Market Structure Shifts
Market Structure Shifts refer to significant changes in the overall structure of the market, such as shifts in trend direction, volatility, or trading activity. These shifts can provide valuable insights into market sentiment and potential trading opportunities, and the Market Structure Shifts component helps traders identify and interpret them.
Overall, the ICT Killzone Toolkit combines these components to provide traders with a comprehensive framework for analyzing the markets and identifying high-probability trading setups.
🔶 SETTINGS
🔹 ICT Killzones
Asian, London Open, New York, and London Close: toggles the visibility of specific Killzones, allowing users to customize time periods and Killzone colors.
Killzone Lines : Top/Bottom, Mean and Extend Top/Bottom: toggles the visibility of the Killzone's pivot high and low lines, mean (average) line, and allows users to extend the pivot lines.
Killzone Labels: Toggles the visibility of the Killzone labels.
Display Killzones within Timeframes Up To: Toggles the visibility of the Killzones up to selected Timeframes.
Open Price, Separator, Label, and Color: toggles the visibility of the open price of the Killzones or for the day, week, or month. If the day, week, or month is selected, a separator will be displayed to highlight the beginning of each respective period. Additionally, users can customize the color and toggle the label as needed.
🔹 Order Blocks & Breaker Blocks
Order Blocks | Breaker Blocks: toggles the visibility of the order blocks & breaker blocks.
Swing Detection Length: lookback period used for the detection of the swing points used to create order blocks & breaker blocks.
Mitigation Price: allows users to select between closing price or wick of the candle.
Use Candle Body in Detection: allows users to use candle bodies as order block areas instead of the full candle range.
Remove Mitigated Order Blocks & Breaker Blocks: toggles the visibility of the mitigated order blocks & breaker blocks.
Extend Order Blocks & Breaker Blocks: enables processing of the order blocks & breaker blocks beyond the boundaries of the killzones.
Display Order Blocks & Breaker Blocks: enables the display of the first, last, or all occurrences of the order blocks & breaker blocks.
Order Blocks : Bullish, Bearish Color: color customization option for order blocks.
Breaker Blocks : Bullish, Bearish Color: color customization option for breaker blocks.
Show Order Blocks & Breaker Blocks Text: toggles the visibility of the order blocks & breaker blocks labels.
🔹 Market Structure Shifts
Market Structure Shifts: toggles the visibility of the market structure shifts.
Detection Length: market structure shift detection length.
Display Market Structure Shifts: enables the display of the first, last, or all occurrences of the market structure shifts.
Market Structure Shifts : Bullish, Bearish Color: color custumization option for market structure shifts.
Show Market Structure Shifts Text: toggles the visibility of the market structure shifts labels.
🔹 Fair Value Gaps
Fair Value Gaps: toggles the visibility of the fair value gaps.
Fair Value Gap Width Filter: filtering threshold wile detecting fair value gaps.
Remove Mitigated Fair Value Gaps: removes mitigated fair value gaps.
Extend Fair Value Gaps: enables processing of the fair value gaps beyond the boundaries of the killzones.
Display Fair Value Gaps: enables the display of the first, last, or all occurrences of the fair value gaps.
Bullish Imbalance Color: color customization option.
Bearish Imbalance Color: color customization option.
Show Fair Value Gaps Text: toggles the visibility of the fair value gaps labels.
🔶 RELATED SCRIPTS
Smart-Money-Concepts
Order-Blocks-Breaker-Blocks
Thanks to our community for recommending this script. For more conceptual scripts and related content, we welcome you to explore by visiting >>> LuxAlgo-Scripts .
Reversal Signals [LuxAlgo]The Reversal Signals indicator is a technical analysis tool that aims to identify when a trend is fading and potentially starting to reverse.
As a counter-trend tool, the Reversal Signals indicator aims to solve the problem of several technical analysis indicators that perform well during trending markets but struggle in ranging markets. By understanding the key concepts and applications of the tool, traders can enhance their market timing and improve their trading strategies.
Note: It's important to explore the settings of the indicator to customize to your own usage & display as there are various options available as covered below.
🔶 USAGE
The Reversal Signals indicator is comprised of two main phases: Momentum Phase and Trend Exhaustion Phase . These phases help identify potential trend reversals in bullish, bearish, and ranging markets.
🔹The Momentum Phase
The momentum phase consists of a 9-candle count and in rare cases 8-candle count. In a bullish trend, a starting number ‘1’ is plotted if a candle closes higher than the close of a candle four periods ago. In a bearish trend, a starting number ‘1’ is plotted if a candle closes lower than the close of a candle four periods ago.
The following numbers are plotted when each successive candle satisfies the four-period rule. The potential reversal point comes when the Reversal Signals plot a label on top of a candle in a bullish trend or at the bottom of a candle in a bearish trend. The momentum phase is immediately canceled if, at any point, a candle fails to satisfy the four-period rule.
Based on the extremes of the momentum phase, the Reversal Signals generate support & resistance levels as well as risk/stop levels.
🔹 The Trend Exhaustion Phase
The trend exhaustion phase starts after completing the momentum phase and consists of a 13-candle count. In a bullish trend exhaustion phase, each candle’s close is compared to the close of two candles earlier, and the close must be greater than the close two periods earlier. In a bearish trend exhaustion phase, each candle’s close is compared to the close of two candles earlier, and the close must be lower than the close two periods earlier.
The trend exhaustion phase does not require a consecutive sequence of candles; if the order of candles is interrupted, the trend exhaustion phase is not canceled. The trend exhaustion phase generates stronger trading signals than the momentum phase, with the potential for longer-lasting price reversals.
🔹 Trading Signals
The Reversal Signals script presents an overall setup and some phase-specific trade setup options, where probable trades might be considered. All phase-specific trade setups, presented as options, are triggered once the selected phase is completed and followed by a price flip in the direction of the trade setup.
Please note that those setups are presented for educational purposes only and do not constitutes professional and/or financial advice
- Momentum: Enter a trade at momentum phase completion, and search for buy (sell) when the bullish (bearish) momentum phase pattern is complete. Ideally, the momentum phase completion should close near its support/resistance line but shall not be above them, which indicates continuation of the trend
- Exhaustion: Enter a trade on trend exhaustion phase completion, and search for buy (sell) when the bullish (bearish) trend exhaustion phase is complete
- Qualified: Buy (sell) when a bullish (bearish) trend exhaustion phase combined with another bullish (bearish) momentum phase sequence is complete
Long trade setups are presented with "L" label and short trade setups with "S" label, where the content of the label displays details related to the probable trade opportunity
Once a phase-specific trade setup is triggered then the Reversal Signals script keeps checking the status of the price action relative to the phase-specific trade setups and in case something goes wrong presents a caution label. Pay attention to the content of the caution labels as well as where they appear. A trade signal, followed immediately by a warning indication can be assumed as a continuation of the underlying trend and can be traded in the opposite direction of the suggested signal
It is strongly advised to confirm trading setups in conjunction with other forms of technical and fundamental analysis, including technical indicators, chart/candlestick pattern analysis, etc.
🔶 DETAILS
The Reversal Signals script performs the detection of the phases by counting the candlestick meeting the specific conditions, which includes:
- Detection of the 8th and 9th candle perfection during the momentum phase
- In some cases, the 8th count will be assumed as momentum phase completion
- Trend exhaustion phase counting stops in case any type of momentum phase completion is detected during the counting process
- Postponing the last count of the trend exhaustion phase, the 13th candle must be below/above the 8th candle and if not the candles will be indicated with '+' sign under them and the script continues to search for a 13th candle at the next ones until the conditions are met
🔶 ALERTS
When an alert is configured, the user will have the ability to be notified in case;
Momentum / Trend Exhaustion phase completion
Support & Resistance level cross detection
Stop / Risk level cross detection
Long / Short Trade Setups are triggered
Please note, alerts are available with 'any alert() function call' and the alerts will be received only for the features that are enabled during alert configuration
🔶 SETTINGS
🔹 Momentum Phase
Display Phases: displays the momentum phases, where the Completed option allows the display of only completed momentum phases. The detailed option allows the display of the entire process of the momentum phase processes
Support & Resistance Levels: Toggles the visibility of the Support & Resistance Levels and Line Styling options
Momentum Phase Risk Levels: Toggles the visibility of the momentum phase Stop/Risk Levels and Line Styling options
For color options please refer to the options available under the style tab
🔹 Trend Exhaustion Phase
Display Phases: displays the trend exhaustion phases, where the Completed option allows the display of only completed trend exhaustion phases. The detailed option allows the display of the entire process of the trend exhaustion phase processes
Trend Exhaustion Phase Risk Levels: Toggles the visibility of the trend exhaustion phase Stop/Risk Levels
Trend Exhaustion Phase Target Levels: Toggles the visibility of the trend exhaustion phase Target Levels
For color options please refer to the options available under the style tab
🔹 Trade Setups
Overall Trend Direction & Trade Setup: displays the overall trend and probable trade setup levels, the users should search for a price flip and confirm with other means of technical and fundamental analysis for the trade setups once the label is plotted
Phase-Specific Trade Setup Options
Momentum: Searches for a trade setup after momentum phase completion
Exhaustion: Searches for a trade setup after trend exhaustion phase completion, stronger trend reversal possibility compared to momentum phase setup
Qualified: Searches for a trade setup after the trend exhaustion phase followed by a momentum phase completion
None: No trade setups are presented
Price Flips against the Phase Specific Trade Setups: enables checking the price action relative to the phase-specific trade setups
🔶 RELATED SCRIPTS
Here are the scripts that may add additional insight during potential trading decisions.
Buyside-Sellside-Liquidity
Support-Resistance-Classification
[TEMPLATE] Code Block Comments█ OVERVIEW
Here I present to the community at large a collection of code comment blocks that I think will be useful, especially for larger script projects bordering on 2,000 lines or above of code.
█ PLANNED FUTURE UPDATES
Work with the community to expand this template to be even more useful with the inclusion of useful global colour sets, variables, tooltips, groups, etc.
better script thumbnail.
full-screen table or label outlining the script's use-cases.
Fibonacci Toolkit [LuxAlgo]This toolkit aims to display multiple Fibonacci drawing tools including retracements, arcs, circles, fans, timezones and spirals.
Usage
Upon adding the indicator to the chart, users will be prompted to choose a starting point and an ending point for the calculation of the drawing tools.
Users can then navigate to the settings of the toolkit and choose which drawing tool to display using the Fibonacci drop-down menu. Users are also free to change the default Fibonacci ratios used by the indicator from within the settings. Each tool is described below.
Retracements
Fibonacci retracements display multiple levels constructed using the starting price point, ending price point, and multiple Fibonacci ratios. These levels can be used as support and resistance.
Arcs
Fibonacci arcs display multiple semi-circles. Each semi-circle crosses the line connecting the starting & end price point at a certain percentage determined by Fibonacci ratios. These arcs can be used as support and resistance.
Circles
The Fibonacci circles are similar to the Fibonacci arcs but display a full circle instead. Users can expect the price to bounce off of the circles.
This tool is less commonly used by traders.
Fan
A Fibonacci fan is a tool displaying trendlines all connected to a starting point and extending to a point determined by Fibonacci ratios. These can also be used as support and resistance.
Timezone
Fibonacci timezones return a series of horizontal lines. The distance of the lines increases by a factor given by the numbers in the Fibonacci sequence.
This tool can be useful to highlight points where a trend might reverse assuming that their duration increases over time.
Spiral
The Fibonnaci spiral displays a spiral that grows by a factor given by the golden ratio. This indicator returns a spiral using 7 turns (5 internal) and sets the origin of the spiral to the ending point which is selected by the user. The height of the spiral is based on the price range between the starting point and ending point.
Note that potential display artifacts can be seen when fitting the spiral on stocks and forex pairs.