Trend and Trendline DetectorTrend and Trendline Detector 
 
 Overview
 
The Trend and Trendline Detector indicator provides both major and minor trend analysis using Simple Moving Averages (SMA) and automatically plots dynamic support and resistance trendlines based on pivot highs and lows. 
 Key Features 
 
 Major Trend Detection: Uses a configurable SMA to determine primary market direction.
 
 Minor Trend Visualization: Optional minor SMA with color-coded line segments to mark smaller trend fluctuations.
 
 Dynamic Pivot Trendlines: Automatically detects pivot highs/lows and draws major (solid) and minor (dashed) trendlines, with user-controlled extension modes.
 
 Customizable Inputs: User can adjust SMA lengths, pivot look back/look forward periods, line extend mode, and toggle features on/off.
 
Buscar en scripts para "TRENDLINES"
TrendLine ScythesTrendline Scythes is a script designed to automatically detect and draw special curved trendlines, resembling scythes or blades, based on pivotal points in price action. These trendlines adapt to the volatility of the market, providing a unique perspective on trend dynamics.
🔲  Methodology 
Traditional trendlines connect consecutive pivot points on a price chart, providing a linear representation of trend direction. However, this script employs a distinctive methodology by automatically detecting price pivots and then calculating special curved trendlines based on the  Average True Range (ATR)  of the price. This introduces a curvature to the trendlines, resembling scythes, offering a unique way to interpret market trends.
🔲  Auto Breakout and Target Detection 
Trendline Scythes includes features for automatic breakout detection, signaling potential trend changes. Additionally, the script assists in target detection, helping traders set realistic and data-driven profit-taking levels based on market volatility and user adjustment.
  
🔲  Utility 
 
 Trend Confirmation -  Use Trendline Scythes to confirm existing trends by observing how price interacts with the curved trendlines.
 Breakout Signals -  Auto-detection of breakouts adds a proactive element to your trading strategy, helping you stay ahead of potential trend reversals.
 Target Setting -  Utilize the script to set profit-taking targets based on volatility, aligning with the current market conditions.
 
🔲  Settings 
 
 Pivot Length -  Swing detection length
 Scythe Length -  Adjusts the length of the scythes blade
 Sensitivity -  Controls how restrained the target calculation is, higher values will result in tighter targets.
 
🔲  Alerts 
 
   Breakout 
   Breakdown 
   Target Reached 
   Target Invalidated 
As well as the option to trigger 'any alert' call.
 
Trendline Scythes is a versatile tool combining the benefits of traditional trendlines with the dynamic adaptability of curved lines for a unique approach to trend analysis.
Trend Lines [LuxAlgo]Our new "Trend Lines" indicator detects and highlights relevant trendlines on the user chart while keeping it free of as much clutter as possible. 
The indicator is thought for real-time usage and includes several filters as well as the ability to estimate trendline angles.
🔶  USAGE 
  
Trendlines can act as support/resistance, with a higher number of tests indicating a more significant support/resistance role.
  
A broken TrendLine can be indicative of a potential trend reversal. The script highlights breaks with a label.
Users can additionally filter trendlines, only showing trendlines whose angles fall within a user set range:
  
  
This allows for the removal of potential clutter from the chart but also helps keep steeper or more horizontal trendlines.
🔶  DETAILS 
When a swing (pivot point) is found, a Trendline is drawn when certain conditions are fulfilled. 
An essential condition is that a Bearish Trendline (red) always occurs on a lower high, while a Bullish Trendline (blue) occurs on a higher low.
  
Our implementation will first show an initial dotted-styled TrendLine on confirmation, after which a solid-styled secondary TrendLine will develop. The latter will be used for the real-time detection of breaks at that line:
Furthermore, the script allows you to add more conditions:
🔹  Length (Swings) 
A swing develops when a high/low is the highest/lowest against x highs/lows on the left AND right of that bar. x can be set by "Length" in settings.
The following images clarify this. The script confirms a swing where the yellow flag is shown; the high (here visualized with a purple label) is the highest point against x bars left and right of that point. 
At that moment, this swing is checked against the previous swing. If all conditions are fulfilled, an initial TrendLine is drawn on confirmation.
  
  
After that point, a secondary thicker solid line is seen which keeps progressing bar after bar, until:
• a new TrendLine is formed 
• the TrendLine is broken
  
🔹  Breaks between Swings 
Once there is confirmation that a TrendLine can be drawn, the script allows you to filter for breakthroughs on that line. This can be set with "Check breaks between"
 
 Disabled : the initial TrendLine is allowed to be pierced:
  
 Check breaks between point A - point B : no breaks are allowed between both Swing points:
  
 Point A - Current bar : no breaks are allowed between the first Swing point and the point of confirmation ('current' bar):
  
 
🔹  TrendLine breaks 
As mentioned, the secondary TrendLine (solid line) progresses bar after bar until a new TrendLine is formed or the TrendLine is broken. When a TrendLine is broken, the TrendLine stops progressing, but if there isn't a new TrendLine and price return back, the TrendLine will re-appear, potentially giving several signals when the TrendLine is broken again.
  Minimal bars  allow you to regulate the amount of signals when the TrendLine is broken.
-> The secondary TrendLine must be uninterrupted for at least x bars before a potential break can be considered.
The following example shows 1 signal against 3 by adjusting this setting from 2 to 5:
  
🔹  Angles 
Angles should normally be calculated when the units of the X and Y axis are the same. However, on our charts, the unit of the X-axis is  bar_index  (bars), and on the Y-axis the unit is  price  (¥, €, £, $,...). 
It is not easy to normalize and create reasonably valid angles. Often certain angle calculations can differ through price changes or volatility.
Our  calculate_slope()  function tries to make corresponding angles through all bars.
We do this by calculating the difference between the highest/lowest price values in a certain bar range. The bar range is our X-axis, and the price difference is our Y-axis.
Zooming in/out will not change the amount of bars or the price. Since it does change our view on the chart, and thereby how we see the angles, we have included a setting where you can personalize the ratio between X and Y-axis (Angles -> Ratio X-Y axis). 
  
Settings: Angles - Ratio X-Y axis:
  
🔶  SETTINGS 
🔹  Swings 
 
 Length: Lookback period for the detection of swing points.
 
🔹  Trendline validation 
 Check breaks between :
 
 Disabled : the initial TrendLine is allowed to be pierced
 Check breaks between point A - point B : no breaks are allowed between both Swing points
 Point A - Current bar : no breaks are allowed between the first Swing point and the point of confirmation ('current' bar)
 
 Source (breaks) : Source which invalidates TrendLine, default:  close 
🔹  TrendLine breaks 
 Minimal bars : The secondary TrendLine must be uninterrupted for at least x bars before a potential break can be considered.
🔹  Angles 
 Show : Toggle labels.
 Ratio X-Y axis : Every user has his preferences regarding zoom, chart layout,...
If the shown angles are not according to your expectations, you can adjust this number.
 Only TrendLine between : Only allow TrendLines between the minimum and maximum degrees. Set only the minimal and maximum values above 0. 
Parallel Projections [theEccentricTrader]█   OVERVIEW 
This indicator automatically projects parallel trendlines or channels, from a single point of origin. In the example above I have applied the indicator twice to the 1D SPXUSD. The five upper lines (green) are projected at an angle of -5 from the 1-month swing high anchor point with a projection ratio of -72. And the seven lower lines (blue) are projected at an angle of 10 with a projection ratio of 36 from the 1-week swing low anchor point. 
█   CONCEPTS 
 Green and Red Candles 
• A green candle is one that closes with a high price equal to or above the price it opened.
• A red candle is one that closes with a low price that is lower than the price it opened.
 Swing Highs and Swing Lows 
• A swing high is a green candle or series of consecutive green candles followed by a single red candle to complete the swing and form the peak.
• A swing low is a red candle or series of consecutive red candles followed by a single green candle to complete the swing and form the trough.
 Peak and Trough Prices (Basic) 
• The peak price of a complete swing high is the high price of either the red candle that completes the swing high or the high price of the preceding green candle, depending on which is higher.
• The trough price of a complete swing low is the low price of either the green candle that completes the swing low or the low price of the preceding red candle, depending on which is lower.
 Historic Peaks and Troughs 
The current, or most recent, peak and trough occurrences are referred to as occurrence zero. Previous peak and trough occurrences are referred to as historic and ordered numerically from right to left, with the most recent historic peak and trough occurrences being occurrence one.
 Support and Resistance 
• Support refers to a price level where the demand for an asset is strong enough to prevent the price from falling further.
• Resistance refers to a price level where the supply of an asset is strong enough to prevent the price from rising further.
Support and resistance levels are important because they can help traders identify where the price of an asset might pause or reverse its direction, offering potential entry and exit points. For example, a trader might look to buy an asset when it approaches a support level , with the expectation that the price will bounce back up. Alternatively, a trader might look to sell an asset when it approaches a resistance level , with the expectation that the price will drop back down.
It's important to note that support and resistance levels are not always relevant, and the price of an asset can also break through these levels and continue moving in the same direction.
 Trendlines 
Trendlines are straight lines that are drawn between two or more points on a price chart. These lines are used as dynamic support and resistance levels for making strategic decisions and predictions about future price movements. For example traders will look for price movements along, and reactions to, trendlines in the form of rejections or breakouts/downs.
█   FEATURES 
 Inputs 
• Anchor Point Type
• Swing High/Low Occurrence
• HTF Resolution
• Highest High/Lowest Low Lookback
• Angle Degree
• Projection Ratio
• Number Lines
• Line Color
 Anchor Point Types 
• Swing High
• Swing Low
• Swing High (HTF)
• Swing Low (HTF)
• Highest High
• Lowest Low
• Intraday Highest High (intraday charts only)
• Intraday Lowest Low (intraday charts only)
 Swing High/Swing Low Occurrence 
This input is used to determine which historic peak or trough to reference for swing high or swing low anchor point types. 
 HTF Resolution 
This input is used to determine which higher timeframe to reference for swing high (HTF) or swing low (HTF) anchor point types. 
 Highest High/Lowest Low Lookback 
This input is used to determine the lookback length for highest high or lowest low anchor point types.
 Intraday Highest High/Lowest Low Lookback 
When using intraday highest high or lowest low anchor point types, the lookback length is calculated automatically based on number of bars since the daily candle opened. 
 Angle Degree 
This input is used to determine the angle of the trendlines. The output is expressed in terms of point or pips, depending on the symbol type, which is then passed through the built in math.todegrees() function. Positive numbers will project the lines upwards while negative numbers will project the lines downwards. Depending on the market and timeframe, the impact input values will have on the visible gaps between the lines will vary greatly. For example, an input of 10 will have a far greater impact on the gaps between the lines when viewed from the 1-minute timeframe than it would on the 1-day timeframe. The input is a float and as such the value passed through can go into as many decimal places as the user requires. 
It is also worth mentioning that as more lines are added the gaps between the lines, that are closest to the anchor point, will get tighter as they make their way up the y-axis. Although the gaps between the lines will stay constant at the x2 plot, i.e. a distance of 10 points between them, they will gradually get tighter and tighter at the point of origin as the slope of the lines get steeper. 
 Projection Ratio 
This input is used to determine the distance between the parallels, expressed in terms of point or pips. Positive numbers will project the lines upwards while negative numbers will project the lines downwards. Depending on the market and timeframe, the impact input values will have on the visible gaps between the lines will vary greatly. For example, an input of 10 will have a far greater impact on the gaps between the lines when viewed from the 1-minute timeframe than it would on the 1-day timeframe. The input is a float and as such the value passed through can go into as many decimal places as the user requires. 
 Number Lines 
This input is used to determine the number of lines to be drawn on the chart, maximum is 500.
█   LIMITATIONS 
All green and red candle calculations are based on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. This may cause some unexpected behaviour on some markets and timeframes. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with.
If the lines do not draw or you see a study error saying that the script references too many candles in history, this is most likely because the higher timeframe anchor point is not present on the current timeframe. This problem usually occurs when referencing a higher timeframe, such as the 1-month, from a much lower timeframe, such as the 1-minute. How far you can lookback for higher timeframe anchor points on the current timeframe will also be limited by your Trading View subscription plan. Premium users get 20,000 candles worth of data, pro+ and pro users get 10,000, and basic users get 5,000. 
█   RAMBLINGS 
It is my current thesis that the indicator will work best when used in conjunction with my  Wavemeter  indicator, which can be used to set the angle and projection ratio. For example, the average wave height or amplitude could be used as the value for the angle and projection ratio inputs. Or some factor or multiple of such an average. I think this makes sense as it allows for objectivity when applying the indicator across different markets and timeframes with different energies and vibrations.  
 “If you want to find the secrets of the universe, think in terms of energy, frequency and vibration.” 
― Nikola Tesla
Fan Projections [theEccentricTrader]█   OVERVIEW 
This indicator automatically projects trendlines in the shape of a fan, from a single point of origin. In the example above I have applied the indicator twice to the 1D SPXUSD. The seven upper lines (green) are projected at an angle of -5 from the 1-month swing high anchor point. And the five lower lines (blue) are projected at an angle of 10 from the 1-week swing low anchor point. 
█   CONCEPTS 
 Green and Red Candles 
• A green candle is one that closes with a high price equal to or above the price it opened.
• A red candle is one that closes with a low price that is lower than the price it opened.
 Swing Highs and Swing Lows 
• A swing high is a green candle or series of consecutive green candles followed by a single red candle to complete the swing and form the peak.
• A swing low is a red candle or series of consecutive red candles followed by a single green candle to complete the swing and form the trough.
 Peak and Trough Prices (Basic) 
• The peak price of a complete swing high is the high price of either the red candle that completes the swing high or the high price of the preceding green candle, depending on which is higher.
• The trough price of a complete swing low is the low price of either the green candle that completes the swing low or the low price of the preceding red candle, depending on which is lower.
 Historic Peaks and Troughs 
The current, or most recent, peak and trough occurrences are referred to as occurrence zero. Previous peak and trough occurrences are referred to as historic and ordered numerically from right to left, with the most recent historic peak and trough occurrences being occurrence one.
 Support and Resistance 
• Support refers to a price level where the demand for an asset is strong enough to prevent the price from falling further.
• Resistance refers to a price level where the supply of an asset is strong enough to prevent the price from rising further.
Support and resistance levels are important because they can help traders identify where the price of an asset might pause or reverse its direction, offering potential entry and exit points. For example, a trader might look to buy an asset when it approaches a support level , with the expectation that the price will bounce back up. Alternatively, a trader might look to sell an asset when it approaches a resistance level , with the expectation that the price will drop back down.
It's important to note that support and resistance levels are not always relevant, and the price of an asset can also break through these levels and continue moving in the same direction.
 Trendlines 
Trendlines are straight lines that are drawn between two or more points on a price chart. These lines are used as dynamic support and resistance levels for making strategic decisions and predictions about future price movements. For example traders will look for price movements along, and reactions to, trendlines in the form of rejections or breakouts/downs.
█   FEATURES 
 Inputs 
• Anchor Point Type
• Swing High/Low Occurrence
• HTF Resolution
• Highest High/Lowest Low Lookback
• Angle Degree
• Number Lines
• Line Color
 Anchor Point Types 
• Swing High
• Swing Low
• Swing High (HTF)
• Swing Low (HTF)
• Highest High
• Lowest Low
• Intraday Highest High (intraday charts only)
• Intraday Lowest Low (intraday charts only)
 Swing High/Swing Low Occurrence 
This input is used to determine which historic peak or trough to reference for swing high or swing low anchor point types. 
 HTF Resolution 
This input is used to determine which higher timeframe to reference for swing high (HTF) or swing low (HTF) anchor point types. 
 Highest High/Lowest Low Lookback 
This input is used to determine the lookback length for highest high or lowest low anchor point types.
 Intraday Highest High/Lowest Low Lookback 
When using intraday highest high or lowest low anchor point types, the lookback length is calculated automatically based on number of bars since the daily candle opened. 
 Angle Degree 
This input is used to determine the angle of the trendlines. The output is expressed in terms of point or pips, depending on the symbol type, which is then passed through the built in math.todegrees() function. Positive numbers will project the lines upwards while negative numbers will project the lines downwards. Depending on the market and timeframe, the impact input values will have on the visible gaps between the lines will vary greatly. For example, an input of 10 will have a far greater impact on the gaps between the lines when viewed from the 1-minute timeframe than it would on the 1-day timeframe. The input is a float and as such the value passed through can go into as many decimal places as the user requires. 
It is also worth mentioning that as more lines are added the gaps between the lines, that are closest to the anchor point, will get tighter as they make their way up the y-axis. Although the gaps between the lines will stay constant at the x2 plot, i.e. a distance of 10 points between them, they will gradually get tighter and tighter at the point of origin as the slope of the lines get steeper. 
 Number Lines 
This input is used to determine the number of lines to be drawn on the chart, maximum is 500.
█   LIMITATIONS 
All green and red candle calculations are based on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. This may cause some unexpected behaviour on some markets and timeframes. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with.
If the lines do not draw or you see a study error saying that the script references too many candles in history, this is most likely because the higher timeframe anchor point is not present on the current timeframe. This problem usually occurs when referencing a higher timeframe, such as the 1-month, from a much lower timeframe, such as the 1-minute. How far you can lookback for higher timeframe anchor points on the current timeframe will also be limited by your Trading View subscription plan. Premium users get 20,000 candles worth of data, pro+ and pro users get 10,000, and basic users get 5,000. 
█   RAMBLINGS 
It is my current thesis that the indicator will work best when used in conjunction with my  Wavemeter  indicator, which can be used to set the angle. For example, the average wave height or amplitude could be used as the value for the angle input. Or some factor or multiple of such an average. I think this makes sense as it allows for objectivity when applying the indicator across different markets and timeframes with different energies and vibrations.  
 “If you want to find the secrets of the universe, think in terms of energy, frequency and vibration.” 
― Nikola Tesla
Confluence Tiered Bullish Entries (MTF Trend Confirm)Draws only the key trendlines: previous day’s high/low, last completed 4H high/low, and last completed 1H high/low.
Fires an alert the instant price touches any of those lines.
Detects bullish Fair Value Gaps (early, as they form), then marks a confluence only when price revisits that FVG.
Confirms with a volume spike + a green candle that closes near the bottom of its range (tunable).
Labels entries as Tier 3 (one confluence), Tier 2 (two), or Tier 1 BUY (all three).
Only shows those trendlines and bullish entry labels on chart.
Volume Based Analysis V 1.00 
 Volume Based Analysis V1.00 – Multi-Scenario Buyer/Seller Power & Volume Pressure Indicator 
 Description:
 
 1. Overview
 
The Volume Based Analysis V1.00 indicator is a comprehensive tool for analyzing market dynamics using Buyer Power, Seller Power, and Volume Pressure scenarios. It detects 12 configurable scenarios combining volume-based calculations with price action to highlight potential bullish or bearish conditions.
When used in conjunction with other technical tools such as Ichimoku, Bollinger Bands, and trendline analysis, traders can gain a deeper and more reliable understanding of the market context surrounding each signal.
 2. Key Features
 
 
 12 Configurable Scenarios covering Buyer/Seller Power convergence, divergence, and dominance
 
 
 Advanced Volume Pressure Analysis detecting when both buy/sell volumes exceed averages
 
 
 Global Lookback System ensuring consistency across all calculations
 
 
 Dominance Peak Module for identifying strongest buyer/seller dominance at structural pivots
 
 
 Real-time Signal Statistics Table showing bullish/bearish counts and volume metrics
 
 
 Fully customizable inputs (SMA lengths, multipliers, timeframes)
 
 
 Visual chart markers (S01 to S12) for clear on-chart identification
 
 3. Usage Guide 
 
 Enable/Disable Scenarios: Choose which signals to display based on your trading strategy
 
 
 
 Fine-tune Parameters: Adjust SMA lengths, multipliers, and lookback periods to fit your market and timeframe
 
 
 Timeframe Control: Use custom lower timeframes for refined up/down volume calculations
 
 
 Combine with Other Indicators:
 
 
 Ichimoku: Confirm volume-based bullish signals with cloud breakouts or trend confirmation
 
 
 
 Bollinger Bands: Validate divergence/convergence signals with overbought/oversold zones
 
 
 
 Trendlines: Spot high-probability signals at breakout or retest points
 
 
 
 Signal Tables & Peaks: Read buy/sell volume dominance at a glance, and activate the Dominance Peak Module to highlight key turning points.
4. Example Scenarios & Suggested Images
 Image #1 – S01 Bullish Convergence Above Zero
 S01 activated, Buyer Power > 0, both buyer power slope & price slope positive, above-average buy volume. Show S01 ↑ marker below bar.
 Image #2 – Combined with Ichimoku
 Display a bullish scenario where price breaks above Ichimoku cloud while S01 or S09 bullish signal is active. Highlight both the volume-based marker and Ichimoku cloud breakout.
 Image #3 – Combined with Bollinger Bands & Trendlines
 Show a bearish S10 signal at the upper Bollinger Band near a descending trendline resistance. Highlight the confluence of the volume pressure signal with the band touch and trendline rejection.
 Image #4 – Dominance Peak Module
 Pivot low with green ▲ Bull Peak and pivot high with red ▼ Bear Peak, showing strong dominance counts.
 Image #5 – Statistics Table in Action
 Bottom-left table showing buy/sell volume, averages, and bullish/bearish counts during an active market phase.
 
 5. Feedback & Collaboration
 
Your feedback and suggestions are welcome — they help improve and refine this system. If you discover interesting use cases or have ideas for new features, please share them in the script’s comments section on TradingView.
 6. Disclaimer
 This script is for educational purposes only. It is not financial advice. Past performance does not guarantee future results. Always do your own analysis before making trading decisions.
Tip: Use this tool alongside trend confirmation indicators for the most robust signal interpretation.
TrendZoneTrendZone - Fibonacci Trendline Indicator 
TrendZone is a custom Pine Script indicator that automatically draws fibonacci-based trendlines between key pivot points on your chart.
Key Features:
3 Pivot Points: Set start point, major pivot (reversal), and end point
Dual Trendlines: First trendline (Point 1 → 2) and second trendline (Point 2 → 3)
Fibonacci Levels: Automatically draws 25%, 50%, and 100% fibonacci levels for each trendline
Auto Trend Detection: Automatically identifies bullish/bearish trends and adjusts colors accordingly
Customizable: Full control over colors, line styles, and widths for each fibonacci level
How it Works:
The indicator uses your selected pivot points to create two connected trendline systems. Point 2 serves as the major pivot where the first trend ends and the reversal begins. Each trendline system includes fibonacci retracement levels that extend to the right, helping identify potential support/resistance zones.
Use Cases:
Identifying trend reversals at key pivot points
Finding potential support/resistance levels using fibonacci projections
Visualizing market structure changes between different time periods
Planning entries/exits based on fibonacci trendline interactions
Perfect for traders who use fibonacci analysis combined with trend structure to identify high-probability trading zones.
Auto FaustAuto Faust – Intraday Market Context & Structure
Auto Faust is a visual market overlay designed for intraday traders who want fast context without relying on signals or automation. It combines classic price tools — VWAP, EMAs, RSI, Chop Score, and market structure trendlines — into a single glanceable dashboard.
🔍 What It Does:
VWAP (Volume Weighted Average Price): Shows the day's fair value price anchor.
EMAs (3, 21, 113, 200): Map short-term to long-term trend alignment. Crossovers can be used for confluence or caution.
RSI (10): Monitors local momentum. Displayed in a compact table.
Chop Score: Measures how directional price action is. High chop = ranging conditions; low = trending.
Session High/Low Tracker: Tracks the daily extremes in real-time.
Volume Monitor: Shows current candle volume, color-coded vs previous bar (green = higher, red = lower).
Dynamic Support & Resistance Lines: Plotted from pivot highs/lows (not static levels).
Automatic Trendlines: Drawn from swing structure, updating live.
📊 How to Use:
Use EMAs + VWAP alignment to assess directional bias.
Confirm clean trends with low Chop Score and RSI support.
Watch for price interaction around dynamic S/R lines and trendline breaks.
Use volume coloring to assess if momentum is increasing or fading.
No buy/sell signals are generated — this is a trader-facing tool to guide discretionary decision-making.
Dow waveform analyzerDow Waveform Analyzer 
 1. Overview and Features of the Indicator   
This indicator is a tool designed to analyze chart waveforms based on Dow Theory, identifying swing lows (support) and swing highs (resistance). It allows users to quickly and consistently determine trend direction. Compared to manual analysis, it provides more efficient and accurate results.  
By using swing lows and swing highs, the indicator offers a more detailed understanding of trends than simple updates to highs and lows, aiding in the creation of effective trading strategies.  
 2. Identifying Wave Lows and Highs   
Stock prices do not move in straight lines; instead, they rise and fall in waves. This indicator starts by identifying the wave lows and wave highs.  
- Wave Low: The lowest point during a temporary price decline.  
- Wave High: The highest point during a temporary price increase.  
These are automatically identified using Pine Script’s built-in functions `pivotlow` and `pivothigh`.  
 3. Drawing the Waveform   
The identified wave lows and highs are alternately connected to draw the waveform. However, there are cases where wave lows or highs occur consecutively:  
- Consecutive Wave Lows: The lower low is used for drawing the waveform.  
- Consecutive Wave Highs: The higher high is used for drawing the waveform.  
 4. Tracking Swing Lows/Highs and Trend Determination   
Swing lows and swing highs are crucial markers that indicate the state of wave progression:  
- Swing Low: The starting point of a wave (wave low) when the closing price exceeds the previous wave high.  
- Swing High: The starting point of a wave (wave high) when the closing price falls below the previous wave low.  
The changes in swing lows and swing highs as the waves progress allow for trend state determination.  
 5. Examples of Trend States   
During an Uptrend:  
- When the price surpasses a wave high, the swing low is updated, confirming the continuation of the uptrend.  
End of an Uptrend:  
- When the price falls below the swing low, the swing low disappears, and a swing high appears, signaling the end of the uptrend.  
Sideways Movement:  
- Swing lows and swing highs alternately appear, indicating a sideways trend.  
Start of a Downtrend:  
- When the price breaks below a wave low for the first time, the swing high is updated, confirming the start of the downtrend.  
During a Downtrend:  
- When the price breaks below a wave low, the swing high is updated, confirming the continuation of the downtrend.  
End of a Downtrend:  
- When the price surpasses a wave high, the swing high disappears, and a swing low reappears, signaling the end of the downtrend.  
Restart of an Uptrend:  
- When the swing low is updated, the uptrend resumes. The uptrend begins when the price surpasses a wave high, and the swing low is updated for the first time.  
 6. Applications   
Trade Entries and Exits:  
- Set stop orders for entry at the price level where a trend starts.  
- Set stop orders for exit at the price level where a trend ends.  
Trend Filtering:  
- Use the indicator to confirm whether market conditions are suitable for entry based on the trend state. Analyze waveforms to aid trading strategies.  
Guide for Drawing Trendlines:  
- Utilize wave lows and highs as starting and ending points when drawing trendlines with drawing tools.  
 7. Parameters and Display Items   
Pivot Points:  
- Wave lows are marked with circles below the candlestick’s low, and wave highs are marked with circles above the candlestick’s high.  
Number of Bars for Pivot Calculation:  
- Specify the number of bars on either side used to identify highs (default: 2).  
Waveform:  
- Specify the color (default: blue) or toggle its visibility (default: visible).  
Swing Lows/Highs:  
- Displayed as large circles. The rightmost large circle on the chart indicates the current swing low or swing high. Historical swing points are also displayed to show the progression of state changes. Specify the color (default: green) or toggle visibility (default: visible).  
 1. インジケーターの概要と特徴 
このインジケーターは、ダウ理論を基にチャートの波形を分析し、押し安値や戻り高値を特定するツールです。これにより、トレンドの方向を迅速かつ一貫して判断できます。手動での分析と比較して、効率的かつ精度の高い結果が得られる点が特徴です。
押し安値や戻り高値を利用することで、単純な高値・安値の更新よりも詳細にトレンドの状況を把握し、効果的な取引戦略の構築に役立ちます。
 2. 波の谷と波の頂の特定 
株価は直線的に動くのではなく、波を描きながら上昇や下落を繰り返します。このインジケーターは、まず波の谷と波の頂を特定するところから始まります。
波の谷: 一時的な下落の最安値
波の頂: 一時的な上昇の最高値
これらを Pine Script の内蔵関数(ピボットローとピボットハイ)を用いて自動的に特定しています。
 3. 波形の描画方法
 特定した波の谷と波の頂を交互に結んで波形を描画します。ただし、波の谷や頂が連続する場合があります。
波の谷が連続する場合: より低い谷を採用して波形を描く
波の頂が連続する場合: より高い頂を採用して波形を描く
 4. 押し安値・戻り高値の追跡とトレンド判断 
押し安値と戻り高値は、波の進行状況を示す重要な指標です。
押し安値: 終値が前回の高値を超えた際の波の谷
戻り高値: 終値が前回の安値を割り込んだ際の波の頂
波の進行に伴う押し安値・戻り高値の変化から、トレンドの状態を判断します。
 5. トレンド状態の具体例 
上昇トレンド中: 
波の頂を株価が上抜け押し安値が更新され続けることで上昇トレンドを継続。
上昇トレンドの終了: 
株価が押し安値を割ると、押し安値が消え、戻り高値が新たに出現して、上昇トレンドを終了。
横ばい状態: 
押し安値と戻り高値が交互に切り替わる。
下降トレンドの開始: 
波の谷を株価が下抜け戻り高値がはじめて更新されることで下降トレンド開始を確認。
下降トレンド中: 
波の谷を株価が下抜け戻り高値が更新され続けることで下降トレンドを継続。
下降トレンドの終了: 
株価が波の頂を超えると、戻り高値が消え、押し安値が再び出現して、下降トレンドを終了。
横ばい状態: 
押し安値と戻り高値が交互に切り替わる。
上昇トレンドの再開: 
押し安値が更新されることで上昇トレンドを確認。
波の頂を株価が上抜け押し安値がはじめて更新されることで上昇トレンド開始を確認。
 6. 応用例 
トレードのエントリーとエグジット: 
トレンド発生の価格に逆指値を設定してエントリー。
トレンド終了の価格に逆指値を設定してエグジット。
トレンドフィルターとして活用: 
エントリーに適したトレンド状況かを確認。波形を分析してトレード戦略の参考に。
トレンドラインを描く時の参考として活用: 
波の谷と頂を描画ツールを使ってトレンドラインを描く時の起点や終点として活用。
 7. パラメーターと表示項目 
ピボット: 波の谷はローソク足の安値にサークルを表示、波の頂はローソク足の高値にサークルを表示。
ピボット計算用のバーの数: 高値を特定するために左右何本のローソク足を使用するかを設定(初期値: 2)。
波形: 色(初期値: 青)や表示(初期値: 表示)の指定。
押し安値・戻り高値: 大きなサークルで表示。チャートの一番右の大きなサークルが現在のもの。過去のものも状態変化の経緯を示すために表示。色(初期値: 緑)や表示(初期値: 表示)の指定。
Support & Resistance AI (K means/median) [ThinkLogicAI]█  OVERVIEW 
K-means is a clustering algorithm commonly used in machine learning to group data points into distinct clusters based on their similarities. While K-means is not typically used directly for identifying support and resistance levels in financial markets, it can serve as a tool in a broader analysis approach.
Support and resistance levels are price levels in financial markets where the price tends to react or reverse. Support is a level where the price tends to stop falling and might start to rise, while resistance is a level where the price tends to stop rising and might start to fall. Traders and analysts often look for these levels as they can provide insights into potential price movements and trading opportunities.
█  BACKGROUND 
The K-means algorithm has been around since the late 1950s, making it more than six decades old. The algorithm was introduced by Stuart Lloyd in his 1957 research paper "Least squares quantization in PCM" for telecommunications applications. However, it wasn't widely known or recognized until James MacQueen's 1967 paper "Some Methods for Classification and Analysis of Multivariate Observations," where he formalized the algorithm and referred to it as the "K-means" clustering method.
So, while K-means has been around for a considerable amount of time, it continues to be a widely used and influential algorithm in the fields of machine learning, data analysis, and pattern recognition due to its simplicity and effectiveness in clustering tasks.
█  COMPARE AND CONTRAST SUPPORT AND RESISTANCE METHODS 
 1)   K-means Approach: 
 
 Cluster Formation:  After applying the K-means algorithm to historical price change data and visualizing the resulting clusters, traders can identify distinct regions on the price chart where clusters are formed. Each cluster represents a group of similar price change patterns.
 Cluster Analysis:  Analyze the clusters to identify areas where clusters tend to form. These areas might correspond to regions of price behavior that repeat over time and could be indicative of support and resistance levels.
 Potential Support and Resistance Levels:  Based on the identified areas of cluster formation, traders can consider these regions as potential support and resistance levels. A cluster forming at a specific price level could suggest that this level has been historically significant, causing similar price behavior in the past.
 Cluster Standard Deviation:  In addition to looking at the means (centroids) of the clusters, traders can also calculate the standard deviation of price changes within each cluster. Standard deviation is a measure of the dispersion or volatility of data points around the mean. A higher standard deviation indicates greater price volatility within a cluster.
 Low Standard Deviation:  If a cluster has a low standard deviation, it suggests that prices within that cluster are relatively stable and less likely to exhibit sudden and large price movements. Traders might consider placing tighter stop-loss orders for trades within these clusters.
 High Standard Deviation:  Conversely, if a cluster has a high standard deviation, it indicates greater price volatility within that cluster. Traders might opt for wider stop-loss orders to allow for potential price fluctuations without getting stopped out prematurely.
 Cluster Density:  Each  data point is assigned to a cluster so a cluster that is more dense will act more like gravity and 
 
 2)  Traditional Approach: 
 
 Trendlines:  Draw trendlines connecting significant highs or lows on a price chart to identify potential support and resistance levels.
 Chart Patterns:  Identify chart patterns like double tops, double bottoms, head and shoulders, and triangles that often indicate potential reversal points.
 Moving Averages:  Use moving averages to identify levels where the price might find support or resistance based on the average price over a specific period.
 Psychological Levels:  Identify round numbers or levels that traders often pay attention to, which can act as support and resistance.
 Previous Highs and Lows:  Identify significant previous price highs and lows that might act as support or resistance.
 
The key difference lies in the approach and the foundation of these methods. Traditional methods are based on well-established principles of technical analysis and market psychology, while the K-means approach involves clustering price behavior without necessarily incorporating market sentiment or specific price patterns.
It's important to note that while the K-means approach might provide an interesting way to analyze price data, it should be used cautiously and in conjunction with other traditional methods. Financial markets are influenced by a wide range of factors beyond just price behavior, and the effectiveness of any method for identifying support and resistance levels should be thoroughly tested and validated. Additionally, developments in trading strategies and analysis techniques could have occurred since my last update.
█  K MEANS ALGORITHM 
The algorithm for K means is as follows:
 
 Initialize cluster centers
 assign data to clusters based on minimum distance
 calculate cluster center by taking the average or median of the clusters
 repeat steps 1-3 until cluster centers stop moving
 
█  LIMITATIONS OF K MEANS 
There are 3 main limitations of this algorithm:
 
 Sensitive to Initializations: K-means is sensitive to the initial placement of centroids. Different initializations can lead to different cluster assignments and final results. 
 Assumption of Equal Sizes and Variances: K-means assumes that clusters have roughly equal sizes and spherical shapes. This may not hold true for all types of data. It can struggle with identifying clusters with uneven densities, sizes, or shapes.
 Impact of Outliers: K-means is sensitive to outliers, as a single outlier can significantly affect the position of cluster centroids. Outliers can lead to the creation of spurious clusters or distortion of the true cluster structure.
 
█  LIMITATIONS IN APPLICATION OF K MEANS IN TRADING 
Trading data often exhibits characteristics that can pose challenges when applying indicators and analysis techniques. Here's how the limitations of outliers, varying scales, and unequal variance can impact the use of indicators in trading:
 
 Outliers  are data points that significantly deviate from the rest of the dataset. In trading, outliers can represent extreme price movements caused by rare events, news, or market anomalies. Outliers can have a significant impact on trading indicators and analyses:
   Indicator Distortion:  Outliers can skew the calculations of indicators, leading to   misleading signals. For instance, a single extreme price spike could cause indicators like moving averages or RSI (Relative Strength Index) to give false signals.
   Risk Management:  Outliers can lead to overly aggressive trading decisions if not  properly accounted for. Ignoring outliers might result in unexpected losses or missed opportunities to adjust trading strategies.
 Different Scales:  Trading data often includes multiple indicators with varying units and scales. For example, prices are typically in dollars, volume in units traded, and oscillators have their own scale. Mixing indicators with different scales can complicate analysis:
  Normalization:  Indicators on different scales need to be normalized or standardized to ensure they contribute equally to the analysis. Failure to do so can lead to one indicator dominating the analysis due to its larger magnitude.
  Comparability:  Without normalization, it's challenging to directly compare the significance of indicators. Some indicators might have a larger numerical range and could overshadow others.
 Unequal Variance:   Unequal variance in trading data refers to the fact that some indicators might exhibit higher volatility than others. This can impact the interpretation of signals and the performance of trading strategies:
  Volatility Adjustment:  When combining indicators with varying volatility, it's essential to adjust for their relative volatilities. Failure to do so might lead to overemphasizing or underestimating the importance of certain indicators in the trading strategy.
  Risk Assessment:  Unequal variance can impact risk assessment. Indicators with higher volatility might lead to riskier trading decisions if not properly taken into account.
 
█  APPLICATION OF THIS INDICATOR 
This indicator can be used in 2 ways:
 1) Make a directional trade: 
 
 If a trader thinks price will go higher or lower and price is within a cluster zone, The trader can take a position and place a stop on the 1 sd band around the cluster.  As one can see below, the trader can go long the green arrow and place a stop on the one standard deviation mark for that cluster below it at the red arrow.  using this we can calculate a risk to reward ratio.
 
 Calculating risk to reward:   targeting a risk reward ratio of 2:1, the trader could clearly make that given that the next resistance area above that in the orange cluster exceeds this risk reward ratio.
 
  
 2) Take a reversal Trade: 
 
 We can use cluster centers (support and resistance levels) to go in the opposite direction that price is currently moving in hopes of price forming a pivot and reversing off this level.    
 Similar to the directional trade, we can use the standard deviation of the cluster to place a stop just in case we are wrong.  
 In this example below we can see that shorting on the red arrow and placing a stop at the one standard deviation above this cluster would give us a profitable trade with minimal risk.
 Using the cluster density table in the upper right informs the trader just how dense the cluster is.  Higher density clusters will give a higher likelihood of a pivot forming at  these levels and price being rejected and switching direction  with a larger move.
 
  
█  FEATURES & SETTINGS 
 General Settings: 
 
 Number of clusters:  The user can select from 3 to five clusters.  A good rule of thumb is that if you are trading intraday, less is more  (Think 3 rather than 5).  For daily 4 to 5 clusters is good.
 Cluster Method:  To get around the outlier limitation of k means clustering,  The median was added.   This gives the user the ability to choose either k means or k median clustering.  K means is the preferred method if the user things there are no large outliers, and if there appears to be large outliers or it is assumed there are then K medians is preferred.
 Bars back To train on:  This will be the amount of bars to include in the clustering.  This number is important so that the user includes bars that are recent but not so far back that they are out of the scope of where price can be.  For example the last 2 years we have been in a range on the sp500 so 505 days in this setting would be more relevant than say looking back 5 years ago because price would have to move far to get there.
 Show SD Bands:  Select this to show the 1 standard deviation bands around the support and resistance level or unselect this to just show the support and resistance level by itself.
 
 Features: 
Besides the support and resistance levels and standard deviation bands, this indicator gives a table in the upper right hand corner to show the density of each cluster (support and resistance level) and is color coded to the cluster line on the chart.  Higher density clusters mean price has been there previously more than lower density clusters and could mean a higher likelihood of a reversal when price reaches these areas.
█  WORKS CITED 
 
 Victor Sim, "Using K-means Clustering to Create Support and Resistance", 2020, towardsdatascience.com
 Chris Piech, "K means", stanford.edu
 
█  ACKNOLWEDGMENTS 
@jdehorty- Thanks for the publish template.  It made organizing my thoughts and work alot easier.
Adaptive Trend Breaks Adaptive Trend Breaks 
## WHAT IT DOES
This script is a modified and enhanced version of "Trendline Breakouts With Targets" concept by ChartPrime. 
Adaptive Trend Breaks (ATB) is a trendline breakout system optimized for scalping liquid futures contracts. The indicator automatically draws dynamic support and resistance trendlines based on pivot points, then generates trade signals when price breaks through these levels with confirmation filters. It includes automated target and stop-loss placement with real-time P&L tracking in dollars.
## HOW IT WORKS
**Trendline Detection Method:**
The indicator uses pivot high/low detection to identify significant price turning points. When a new pivot forms, it calculates the slope between consecutive pivots to draw dynamic trendlines. These lines extend forward based on the established trend angle, creating actionable support and resistance zones.
**Band System:**
Around each trendline, the script creates a "band" using a volatility-adjusted calculation: `ATR(14) * 0.2 * bandwidth multiplier / 2`. This adaptive band accounts for current market conditions - wider during volatile periods, tighter during quiet markets.
**Breakout Logic:**
A breakout signal triggers when:
1. Price closes beyond the trendline + band zone
2. Volume exceeds the 20-period moving average by your set multiplier (default 1.2x)
3. Price is within Regular Trading Hours (9:30-16:00 EST) if session filter enabled
4. Current ATR meets minimum volatility threshold (prevents trading dead markets)
**Target & Stop Calculation:**
Upon breakout confirmation:
- **Entry**: Trendline breach point
- **Target**: Entry ± (bandwidth × target multiplier) - default 8x for quick scalps
- **Stop**: Entry ± (bandwidth × stop multiplier) - default 8x for 1:1 risk/reward
- Multipliers adjust automatically to market volatility through the ATR-based band
**P&L Conversion:**
The script converts point movements to dollars using:
```
Dollar P&L = (Price Points × Contract Point Value × Quantity)
```
For example, a 10-point NQ move with 2 contracts = 10 × $20 × 2 = $400
## HOW TO USE IT
**Setup:**
1. Select your instrument (NQ/ES/YM/RTY) - point values auto-configure
2. Set contract quantity for accurate dollar P&L
3. Choose pivot period (lower = more signals but more noise, default 5 for scalping)
4. Adjust bandwidth multiplier if trendlines are too tight/loose (1-5 range)
**Filters Configuration:**
- **Volume Filter**: Requires breakout volume > moving average × multiplier. Increase multiplier (1.5-2.0) for higher conviction trades
- **Session Filter**: Enable to trade only RTH. Disable for 24-hour trading
- **ATR Filter**: Prevents signals during low volatility. Increase minimum % for more active markets only
**Risk Management:**
- Set target/stop multipliers based on your risk tolerance
- 8x bandwidth = approximately 1:1 risk/reward for most liquid futures
- Enable trailing stops for trend-following approach (moves stop to protect profits)
- Adjust line length to see targets further into the future
**Statistics Table:**
- Choose timeframe to analyze: all-time, today, this week, custom days
- Monitor win rate, profit factor, and net P&L in dollars
- Track long vs short performance separately
- See real-time unrealized P&L on active trades
**Reading Signals:**
- **Green triangle below bar** = Long breakout (resistance broken)
- **Red triangle above bar** = Short breakout (support broken)
- **White dashed line** = Entry price
- **Orange line** = Take profit target with dollar value
- **Red line** = Stop loss with dollar value
- **Green checkmark (✓)** = Target hit, winning trade
- **Red X (✗)** = Stop hit, losing trade
## WHAT IT DOES NOT DO
**Limitations to Understand:**
- Does not predict future trendline formations - it reacts to breakouts after they occur
- Historical trendlines disappear after breakout (not kept on chart for clarity)
- Requires sufficient volatility - may not signal in extremely quiet markets
- Volume filter requires exchange volume data (not available on all symbols)
- Statistics are indicator-based simulations, not actual trading results
- Does not account for slippage, commissions, or order fills
## BEST PRACTICES
**Recommended Settings by Market:**
- **NQ (Nasdaq)**: Default settings work well, consider volume multiplier 1.3-1.5
- **ES (S&P 500)**: Slightly slower, try period 7-8, volume 1.2
- **YM (Dow)**: Lower volatility, reduce bandwidth to 1.5-2
- **RTY (Russell)**: Higher volatility, increase bandwidth to 3-4
**Risk Management:**
- Never risk more than 2-3% of account per trade
- Use contract quantity calculator: Max Risk $ ÷ (Stop Distance × Point Value)
- Start with 1 contract while learning the system
- Backtest your specific timeframe and instrument before live trading
**Optimization Tips:**
- Increase pivot period (7-10) for fewer but higher-quality signals
- Raise volume multiplier (1.5-2.0) in choppy markets
- Lower target/stop multipliers (5-6x) for tighter profit taking
- Use trailing stops in strong trending conditions
- Disable session filter for overnight gaps and Asia session moves
## TECHNICAL DETAILS
**Key Calculations:**
- Pivot Detection: `ta.pivothigh(high, period, period/2)` and `ta.pivotlow(low, period, period/2)`
- Slope Calculation: `(newPivot - oldPivot) / (newTime - oldTime)`
- Adaptive Band: `min(ATR(14) * 0.2, close * 0.002) * multiplier / 2`
- Breakout Confirmation: Price crosses trendline + 10% of band threshold
**Data Requirements:**
- Minimum bars in view: 500 for proper pivot calculation
- Volume data required for volume filter accuracy
- Intraday timeframes recommended (1min - 15min) for scalping
- Works on any timeframe but optimized for fast execution
**Performance Metrics:**
All statistics calculate based on indicator signals:
- Tracks every signal as a trade from entry to TP/SL
- P&L in actual contract dollar values
- Win rate = (Winning trades / Total trades) × 100
- Profit factor = Gross profit / Gross loss
- Separates long/short performance for bias analysis
## IDEAL FOR
- Futures scalpers and day traders
- Traders who prefer visual trendline breakouts
- Those wanting automated TP/SL placement
- Traders tracking performance in dollar terms
- Multiple timeframe analysis (compare 1min vs 5min signals)
## NOT SUITABLE FOR
- Swing trading (targets too close)
- Stocks/forex without modifying point values
- Extremely low timeframes (<30 seconds) - too much noise
- Markets without volume data if using volume filter
- Illiquid contracts (signals may not execute at shown prices)
---
**Settings Summary:**
- Core: Period, bandwidth, extension, trendline style
- Filters: Volume, RTH session, ATR volatility
- Risk: R:R ratio, target/stop multipliers, trailing stop
- Display: Stats table position, size, colors
- Stats: Timeframe selection (all-time to custom days)
**License:** This indicator is published open-source under Mozilla Public License 2.0. You may use and modify the code with proper attribution.
**Disclaimer:** This indicator is for educational purposes. Past performance does not guarantee future results. Always practice proper risk management and test thoroughly before live trading.
---
## CREDITS & ATTRIBUTION
This script builds upon the "Trendline Breakouts With Targets" concept by ChartPrime with significant enhancements:
**Major Improvements Added:**
- **Futures-Specific Calculations**: Automated dollar P&L conversion using actual contract point values (NQ=$20, ES=$50, YM=$5, RTY=$50)
- **Advanced Statistics Engine**: Comprehensive performance tracking with customizable timeframe analysis (today, week, month, custom ranges)
- **Multi-Layer Filtering System**: Volume confirmation, RTH session filter, and ATR volatility filter to reduce false signals
- **Professional Trade Management**: Enhanced visual trade tracking with separate TP/SL lines, dollar value labels, and optional trailing stops
- **Optimized for Scalping**: Faster pivot periods (5 vs 10), tighter bands, and reduced extension bars for quick entries
Original trendline detection methodology by ChartPrime - used with modification under Mozilla Public License 2.0.
Auto Trend Lines v1.0 This advanced Pine Script indicator automatically detects and draws support and resistance trendlines for any instrument based on two independent lookback periods—short-term and long-term—making it suitable for all types of traders. The indicator identifies pivot highs and lows for both user-configurable lookback lengths, draws trendlines from each anchor point to the current bar, and supports a visually intuitive chart by coloring and labeling each line type separately.
Key features:
Dual lookback: Choose separate short-term and long-term sensitivity for pivots and trendlines.
Customizable: Select the number of displayed lines, colors, and line widths to suit your preferences.
Auto-updating: Trendlines update dynamically with new pivots and extend to the latest bar.
This indicator is ideal for those who want to automate trendline analysis, spot key breakout and reversal areas, and streamline technical trading.
Custom Support & Resistance LevelsThe Smart Auto Trendline Indicator is designed to help traders quickly identify key market trends without the need for manual drawing. It automatically detects swing highs and lows, plots dynamic trendlines, and updates them in real-time as price evolves.
This tool is especially useful for traders who rely on trendline breakouts, pullback entries, or reversal confirmations. By simplifying chart analysis, it saves time and ensures more consistent results.
Key Features:
🔹 Automatic detection of valid swing highs and lows
🔹 Dynamic trendline plotting (auto-adjusts as price moves)
🔹 Highlights potential breakout and breakdown zones
🔹 Works on all timeframes and instruments (Forex, Stocks, Indices, Crypto)
🔹 Clean, non-intrusive design to keep charts clear
🔹 Customizable settings (line color, style, sensitivity)
How to Use:
Apply the indicator to your chart.
Observe automatically drawn trendlines.
Watch for breakouts above/below trendlines for trade entries.
Use in combination with other tools like RSI, MACD, or support/resistance for stronger confirmation.
Best For:
Breakout traders
Swing traders
Trend followers
Forex, Stocks, Crypto, Indices
Smart Trend EnvelopeThe "Smart Trend Envelope" indicator is a powerful tool that combines the "Nadaraya-Watson Envelope  " indicator by LuxAlgo and the "Strongest Trendline" indicator by Julien_Eche. 
This indicator provides valuable insights into price trends and projection confidence levels in financial markets. However, it's important to note that the indicator may repaint, meaning that the displayed results can change after the fact.
The "Strongest Trendline" indicator by Julien_Eche focuses on identifying the strongest trendlines using logarithmic transformations of price data. It calculates the slope, average, and intercept of each trendline over user-defined lengths. The indicator also provides standard deviation, Pearson's R correlation coefficient, and upper/lower deviation values to assess the strength and reliability of the trendlines.
In addition, the "Nadaraya-Watson Envelope  " indicator developed by LuxAlgo utilizes the Nadaraya-Watson kernel regression technique. It applies a kernel function to smooth the price data and estimate future price movements. The indicator allows adjustment of the bandwidth parameter and multiplier to control the width of the envelope lines around the smoothed line.
Combining these two indicators, the "Smart Trend Envelope" indicator offers traders and investors a comprehensive analysis of price trends and projection confidence levels. It automatically selects the strongest trendline length based on the highest Pearson's R correlation coefficient. Traders can observe the trendlines on the price chart, along with upper and lower envelope lines generated by the Nadaraya-Watson smoothing technique.
The "Smart Trend Envelope" indicator has several qualities that make it a valuable tool for technical analysis:
1. Automatic Length Selection: The indicator dynamically selects the optimal trendline length based on the highest Pearson's R correlation coefficient, ensuring accurate trend analysis.
2. Projection Confidence Level: The indicator provides a projection confidence level ranging from "Ultra Weak" to "Ultra Strong." This allows traders to assess the reliability of the projected trend and make informed trading decisions.
3. Color-Coded Visualization: The indicator uses color schemes, such as teal and red, to highlight the direction of the trend and the corresponding envelope lines. This visual representation makes it easier to interpret the market trends at a glance.
4. Customizable Settings: Traders can adjust parameters such as bandwidth, multiplier, line color, and line width to tailor the indicator to their specific trading strategies and preferences.
The "Smart Trend Envelope" indicator has been specifically designed and coded to be used in logarithmic scale. It takes advantage of the logarithmic scale's ability to represent exponential price movements accurately. Therefore, it is highly recommended to use this indicator with the chart set to logarithmic scale for optimal performance and reliable trend analysis, especially on higher timeframes.
It's important to remember that the "Smart Trend Envelope" indicator may repaint, meaning that the displayed results can change after the fact. Traders should use this indicator as a tool for generating trade ideas and confirmation, rather than relying solely on its historical values. Combining the indicator with other technical analysis tools and considering fundamental factors can lead to more robust trading strategies.
Auto Trend ProjectionAuto Trend Projection is an indicator designed to automatically project the short-term trend based on historical price data. It utilizes a dynamic calculation method to determine the slope of the linear regression line, which represents the trend direction. The indicator takes into account multiple length inputs and calculates the deviation and Pearson's R values for each length.
Using the highest Pearson's R value, Auto Trend Projection identifies the optimal length for the trend projection. This ensures that the projected trend aligns closely with the historical price data.
The indicator visually displays the projected trend using trendlines. These trendlines extend into the future, providing a visual representation of the potential price movement in the short term. The color and style of the trendlines can be customized according to user preferences.
Auto Trend Projection simplifies the process of trend analysis by automating the projection of short-term trends. Traders and investors can use this indicator to gain insights into potential price movements and make informed trading decisions.
Please note that Auto Trend Projection is not a standalone trading strategy but a tool to assist in trend analysis. It is recommended to combine it with other technical analysis tools and indicators for comprehensive market analysis.
Overall, Auto Trend Projection offers a convenient and automated approach to projecting short-term trends, empowering traders with valuable insights into the potential price direction.
Double Supertrend Entry with ADX Filter and ATR Exits/EntriesThe Double Supertrend Entry with ADX Filter and ATR Exits/Entries indicator is a custom trading strategy designed to help traders identify potential buy and sell signals in trending markets. This indicator combines the strengths of multiple technical analysis tools, enhancing the effectiveness of the overall strategy.
Key features:
Two Supertrend Indicators - The indicator includes two Supertrend indicators with customizable parameters. These trend-following indicators calculate upper and lower trendlines based on the ATR and price. Buy signals are generated when the price crosses above both trendlines, and sell signals are generated when the price crosses below both trendlines.
ADX Filter - The Average Directional Index (ADX) is used to filter out weak trends and only generate buy/sell signals when the market exhibits a strong trend. The ADX measures the strength of the trend, and a customizable threshold level ensures that trades are only entered during strong trends.
ATR-based Exits and Entries - The indicator uses the Average True Range (ATR) to set profit target and stop-loss levels. ATR is a measure of market volatility, and these levels help traders determine when to exit a trade to secure profit or minimize loss.
Performance Statistics Table - A table is displayed on the chart, recording and showing the total number of winning trades, losing trades, percentage of profitable trades, average profit, and average loss. This information helps traders evaluate the performance of the strategy over time.
The Double Supertrend Entry with ADX Filter and ATR Exits/Entries indicator is a powerful trend-following strategy that can assist traders in making more informed decisions in the financial markets. By combining multiple technical analysis tools and providing performance statistics, this indicator helps traders improve their trading strategy and evaluate its success.
Swing Points & Liquidity — ENHANCED PRO (Dark/Light Mode)This indicator — “Swing Points & Liquidity — ENHANCED PRO (Dark/Light Mode)” — automatically detects and visualizes swing highs, swing lows, and liquidity levels on the chart with rich analytics and customizable visuals.
🔍 Core Features
Smart Swing Detection: Identifies pivot highs/lows based on adjustable left/right bar settings.
Liquidity Visualization: Draws dynamic boxes and lines for liquidity pools and swing zones.
Volume & OI Integration: Filters and colors levels using volume and Open Interest Δ (change).
Strength Meter: Highlights strong liquidity levels with color gradients based on OI + volume intensity.
Automatic Trendlines: Connects swing points with selectable style and width.
Fibonacci Mapping: Automatically projects fib retracements (23.6%, 38.2%, 50%, 61.8%, 78.6%) from swing-to-swing for confluence zones.
Statistics Panel: Displays live metrics — total levels, active/filled count, success rate, and average strength.
Alerts System: Alerts for new swing formations and when price touches or breaks a level.
Multi-Timeframe Option: Analyze swing structures from higher timeframes on any chart.
Dual Theme Mode: Fully optimized for both Dark and Light interface preferences.
⚙️ Advanced Options
Adjustable lookback range
Hide or extend filled levels
Configurable volume and OI thresholds
Supports multiple OI data sources (Binance, BitMEX, Kraken)
Fully dynamic text, color, and label alignment settings
💡 Use Case
Perfect for Smart Money Concept (SMC) and ICT-style analysis, liquidity sweeps, and swing-based trading.
Traders can quickly visualize where liquidity sits, track how it gets filled, and monitor structure shifts in real time.
Multipower Entry SecretMultipower Entry Secret indicator is designed to be the ultimate trading companion for traders of all skill levels—especially those who struggle with decision-making due to unclear or overwhelming signals. Unlike conventional trading systems cluttered with too many lines and confusing alerts, this indicator provides a clear, adaptive, and actionable guide for market entries and exits.
Key Points:
Clear Buy/Sell/Wait Signals:
The script dynamically analyzes price action, candle patterns, volume, trend strength, and higher time frame context. This means it gives you “Buy,” “Sell,” or “Wait” signals based on real, meaningful market information—filtering out the noise and weak trades.
Multi-Timeframe Adaptive Analysis:
It synchronizes signals between higher and current timeframes, ensuring you get the most reliable direction—reducing the risk of getting caught in fake moves or sudden reversals.
Automatic Support, Resistance & Liquidity Zones:
Key levels like support, resistance, and liquidity zones are auto-detected and displayed directly on the chart, helping you make precise decisions without manual drawing.
Real-Time Dashboard:
All relevant information, such as trend strength, market intent, volume sentiment, and the reason behind each signal, is neatly summarized in a dashboard—making monitoring effortless and intuitive.
Customizable & Beginner-Friendly:
Whether you’re a newcomer wanting straightforward guidance or a professional needing advanced customization, the indicator offers flexible options to adjust analysis depth, timeframes, sensitivity, and more.
Visual & Clutter-Free:
The design ensures that your chart remains clean and readable, showing only the most important information. This minimizes mental overload and allows for instant decision-making.
Who Will Benefit?
Beginners who want to learn trading logic, avoid common traps, and see the exact reason behind every signal.
Advanced traders who require adaptive multi-timeframe analytics, fast execution, and stress-free monitoring.
Anyone who wants to save screen time, reduce analysis paralysis, and have more confidence in every trade they take.
1. No Indicator Clutter
Intent:
Many traders get confused by charts filled with too many indicators and signals. This often leads to hesitation, missed trades, or taking random, risky trades.
In this Indicator:
You get a clean and clutter-free chart. Only the most important buy/sell/wait signals and relevant support/resistance/liquidity levels are shown. These update automatically, removing the “overload” and keeping your focus sharp, so your decision-making is faster and stress-free.
2. Exact Entry Guide
Intent:
Traders often struggle with entry timing, leading to FOMO (fear of missing out) or getting trapped in sudden market reversals.
In this Indicator:
The system uses powerful adaptive logic to filter out weak signals and only highlight the strongest market moves. This not only prevents you from entering late or on noise, but also helps avoid losses from false breakouts or whipsaws. You get actionable suggestions—when to enter, when to hold back—so your entries are high-conviction and disciplined.
3. HTF+LTF Logic: Multitimeframe Sync Analysis
Intent:
Most losing trades happen when you act only on the short-term chart, ignoring the bigger market trend.
In this Indicator:
Signals are based on both the current chart timeframe (LTF) and a higher (HTF, like hourly/daily) timeframe. The indicator synchronizes trend direction, momentum, and structure across both levels, quickly adapting to show you when both are aligned. This filtering results in “only trade with the bigger trend”—dramatically increasing your win rate and market confidence.
4. Auto Support/Resistance & Liquidity Zones
Intent:
Drawing support/resistance and liquidity zones manually is time-consuming and error-prone, especially for beginners.
In this Indicator:
The system automatically identifies and plots the most crucial support/resistance levels and liquidity zones on your chart. This is based on adaptive, real-time price and volume analysis. These zones highlight where major institutional activity, trap setups, or real breakouts/reversals are most likely, removing guesswork and giving you a clear reference for entries, exits, and stop placements.
5. Clear Action/Direction
Intent:
Traders need certainty—what does the market want right now? Most indicators are vague.
In this Indicator:
Your dashboard always displays in plain words (like “BUY”, “SELL”, or “WAIT”) what action makes sense in the current market phase. Whether it’s a bull trap, volume spike, wick reversal, or exhaustion—it’s interpreted and explained clearly. No more confusion—just direct, real-time advice.
6. For Everyone (Beginner to Pro)
Intent:
Most advanced indicators are overwhelming for new traders; simple ones lack depth for professionals.
In this Indicator:
It is simple enough for a beginner—just add it to the chart and instantly see what action to consider. At the same time, it includes advanced adaptive analysis, multi-timeframe logic, and customizable settings so professional traders can fine-tune it for their strategies.
7. Ideal Usage and User Benefits
Instant Decision Support:
Whenever you’re unsure about a trade, just look at the indicator’s suggestion for clarity.
Entry Learning:
Beginners get real-time “practice” by not only seeing signals, but also the reason behind them—improving your chart reading and market understanding.
Screen Time & Stress Reduction:
Clear, relevant information only; no noise, less fatigue, faster decisions.
Makes Trading Confident & Simple:
The smart dashboard splits actionable levels (HTF, LTF, action) so you never miss a move, avoid traps, and stay aligned with high-probability trades.
8. Advanced Input Settings (Smart Customization)
Explained with Examples:
Enable Wick Analysis:
Finds candles with strong upper/lower wicks (signs of rejection/buying/selling force), alerting you to hidden reversals and protecting from FOMO entries.
Enable Absorption:
Detects when heavy order flow from one side is “absorbed” by the other (shows where institutional buyers/sellers are likely active, helps spot fake breakouts).
Enable Unusual Breakout:
Highlights real breakouts—large volatility plus high volume—so you catch genuine moves and avoid random spikes.
Enable Range/Expansion:
Smartly flags sudden range expansions—when the market goes from quiet to volatile—so you can act at the start of real trends.
Trend Bar Lookback:
Adjusts how many bars/candles are used in trend calculations. Short (fast trades, more signals), long (more reliability, fewer whipsaws).
Bull/Bear Bars for Strong Trend Min:
Sets how many candles in a row must support a trend before calling it “strong”—prevents flipping signals, keeps you disciplined.
Volume MA Length:
Lets you adjust how many bars back volume is averaged—fine-tune for your asset and trading style for best volume signals.
Swing Lookback Bars:
Set how many bars to use for swing high/low detection—short (quick swing levels), long (stronger support/resistance).
HTF (Bias Window):
Decide which higher timeframe the indicator should use for big-picture market mood. Adjustable for any style (scalp, swing, position).
Adaptive Lookback (HTF):
Choose how much HTF history is used for detecting major extremes/zones. Quick adjust for more/less sensitivity.
Show Support/Resistance, Liquidity Zones, Trendlines:
Toggle them on/off instantly per your needs—keeps your chart relevant and tailored.
9. Live Dashboard Sections Explained
Intent HTF:
Shows if the bigger timeframe currently has a Bullish, Bearish, or Neutral (“Chop”) intent, based on strict volume/price body calculations. Instant clarity—no more guessing on trend bias.
HTF Bias:
Clear message about which side (buy/sell/sideways) controls the market on the higher timeframe, so you always trade with the “big money.”
Chart Action:
The central action for the current bar—Whether to Buy, Sell, or Wait—calculated from all indicator logic, not just one rule.
TrendScore Long/Short:
See how many candles in your chosen window were bullish or bearish, at a glance. Instantly gauge market momentum.
Reason (WHY):
Every time a signal appears, the “reason” cell tells you the primary logic (breakout, wick, strong trend, etc.) behind it. Full transparency and learning—never trade blindly.
Strong Trend:
Shows if the market is currently in a powerful trend or not—helping you avoid choppy, risky entries.
HTF Vol/Body:
Displays current higher timeframe volume and candle body %—helping spot when big players are active for higher probability trades.
Volume Sentiment:
A real-time analysis of market psychology (strong bullish/bearish, neutral)—making your decision-making much more confident.
10. Smart and User-Friendly Design
Multi-timeframe Adaptive:
All calculations can now be drawn from your choice of higher or current timeframe, ensuring signals are filtered by larger market context.
Flexible Table Position:
You can set the live dashboard/summary anywhere on the chart for best visibility.
Refined Zone Visualization:
Liquidity and order blocks are visually highlighted, auto-tuning for your settings and always cleaning up to stay clutter-free.
Multi-Lingual & Beginner Accessible:
With Hindi and simple English support, descriptions and settings are accessible for a wide audience—anyone can start using powerful trading logic with zero language barrier.
Efficient Labels & Clear Reasoning:
Signal labels and reasons are shown/removed dynamically so your chart stays informative, not messy.
Every detail of this indicator is designed to make trading both simpler and smarter—helping you avoid the common pitfalls, learn real price action, stay in sync with the market’s true mood, and act with discipline for higher consistency and confidence.
This indicator makes professional-grade market analysis accessible to everyone. It’s your trusted assistant for making smarter, faster, and more profitable trading decisions—providing not just signals, but also the “why” behind every action. With auto-adaptive logic, clear visuals, and strong focus on real trading needs, it lets you focus on capturing the moves that matter—every single time.
ABO LANA-𝑀1. إشارات التداول الرئيسية:
إشارة شراء (BUY):
تظهر عند تحول اتجاه السوق من هابط إلى صاعد، مع إغلاق السعر فوق المتوسط المتحرك (EMA 9).
إشارة بيع (SELL):
تظهر عند تحول الاتجاه من صاعد إلى هابط، مع إغلاق السعر تحت المتوسط المتحرك.
2. مناطق العرض والطلب (Supply/Demand):
مناطق العرض (Supply):
تمثل مستويات مقاومة رئيسية (لون أحمر) تُرسم عند القمم السعرية.
مناطق الطلب (Demand):
تمثل مستويات دعم رئيسية (لون أخضر) تُرسم عند القيعان السعرية.
تحديث تلقائي بناءً على حركة السعر وأطر زمنية متعددة.
3. إدارة المخاطر والأرباح:
وقف الخسارة (SL):
يُحسب باستخدام مضاعف ATR (المدى الحقيقي).
مستويات الأرباح (TP1, TP2, TP3):
مستويات ثلاثية للأرباح مع مضاعفات قابلة للتخصيص.
تنبيهات صوتية عند تحقيق كل هدف.
4. لوحة المعلومات (Dashboard):
اتجاه السوق: صاعد/هابط عبر 6 أطر زمنية (من 1 دقيقة إلى يومي).
مؤشر الزخم (Momentum):
اتجاه حركة السعر خلال 10 شمعات.
RSI مخصص:
يجمع بين RSI قصير المدى (2) ومتوسط متحرك (7).
حجم التداول: صاعد/هابط مقارنة بالمتوسط.
قوة الترند (ADX): قوي/ضعيف.
5. ميزات إضافية:
خطوط اتجاه ديناميكية:
تُرسم تلقائياً بين القمم والقيعان.
مستويات دعم/مقاومة:
مستخرجة من 7 أطر زمنية (H4, H1, M30, ...).
نطاق متوسط (Middle Band):
خط برتقالي يعكس متوسط حركة السعر.
تحليل السيولة:
يعتمد على شموع هايكين أشي وحجم التداول.
Brief Explanation of ABO LANA-M (English):
1. Core Trading Signals:
BUY Signal:
Triggers when market trend shifts from bearish to bullish, with price closing above EMA 9.
SELL Signal:
Activates when trend reverses from bullish to bearish, with price closing below EMA 9.
2. Supply/Demand Zones:
Supply Zones (Red):
Key resistance levels plotted at swing highs.
Demand Zones (Green):
Key support levels plotted at swing lows.
Auto-updated based on price action across multiple timeframes.
3. Risk & Profit Management:
Stop Loss (SL):
Calculated using ATR multiplier.
Take Profit Targets (TP1, TP2, TP3):
Three customizable profit levels.
Audio alerts when each target is hit.
4. Smart Dashboard:
Market Trend: Bullish/Bearish across 6 timeframes (1m to Daily).
Momentum Indicator:
Price movement direction over 10 candles.
Custom RSI:
Combines RSI(2) with SMA(7) for smoother readings.
Volume Analysis:
Compares current volume to 20-period average.
Trend Strength (ADX): Strong/Weak.
5. Advanced Features:
Dynamic Trendlines:
Automatically drawn between swing highs/lows.
Support/Resistance Levels:
Extracted from 7 timeframes (H4, H1, M30, etc.).
Middle Band:
Orange line showing price equilibrium.
Liquidity Analysis:
Based on Heikin Ashi candles and volume confirmation.
Smart Trend Lines [The_lurker]
Smart Trend Lines
A multi-level trend classifier that detects bullish and bearish conditions using a methodology based on drawing trend lines—main, intermediate, and short-term—by identifying peaks and troughs. The tool highlights trend strength by applying filters such as the Average Directional Index (ADX) (A), Relative Strength Index (RSI) (R), and Volume (V), making it easier to interpret trend strength. The filter markers (V, A, R) in the Smart Trend Lines indicator are powerful tools for assessing the reliability of breakouts. Breakouts containing   are the most reliable, as they indicate strong volume support, trend strength, and favorable momentum. Breakouts with partial filters (such as   or  ) require additional confirmation, while breakouts without filters ( ) should be avoided unless supported by other strong signals. By understanding the meaning of each filter and the market context.
Core Functionality
1. Trend Line Types
The indicator generates three distinct trend line categories, each serving a specific analytical purpose:
Main Trend Lines: These are long-term trend lines designed to capture significant market trends. They are calculated based on pivot points over a user-defined period (default: 50 bars). Main trend lines are ideal for identifying macro-level support and resistance zones.
Mid Trend Lines: These are medium-term trend lines (default: 21 bars) that focus on intermediate price movements. They provide a balance between short-term fluctuations and long-term trends, suitable for swing trading strategies.
Short Trend Lines: These are short-term trend lines (default: 9 bars) that track rapid price changes. They are particularly useful for scalping or day trading, highlighting immediate support and resistance levels.
Each trend line type can be independently enabled or disabled, allowing traders to tailor the indicator to their preferred timeframes.
2. Breakout Detection
The indicator employs a robust breakout detection system that identifies when the price crosses a trend line, signaling a potential trend reversal or continuation. Breakouts are validated using the following filters:
ADX Filter: The Average Directional Index (ADX) measures trend strength. A user-defined threshold (default: 20) ensures that breakouts occur during strong trends, reducing false signals in range-bound markets.
RSI Filter: The Relative Strength Index (RSI) identifies overbought or oversold conditions. Breakouts are filtered based on RSI thresholds (default: 65 for overbought, 35 for oversold) to avoid signals in extreme market conditions.
Volume Filter: Breakouts are confirmed only when trading volume exceeds a moving average (default: 20 bars) and aligns with the breakout direction (e.g., higher volume on bullish breakouts when the candle closes higher).
Breakout events are marked with labels on the chart, indicating the type of trend line broken (Main, Mid, or Short) and the filters satisfied (Volume, ADX, RSI). Alerts are triggered for each breakout, providing real-time notifications.
3. Customization Options
The indicator offers extensive customization through input settings, organized into logical groups for ease of use:
Main Trend Line Settings
Length: Defines the number of bars used to calculate pivot points (default: 50).
Bullish Color: Color for upward-sloping (bullish) main trend lines (default: green).
Bearish Color: Color for downward-sloping (bearish) main trend lines (default: red).
Style: Line style options include solid, dashed, or dotted (default: solid).
Mid Trend Line Settings
Length: Number of bars for mid-term pivot points (default: 21).
Show/Hide: Toggle visibility of mid trend lines (default: enabled).
Bullish Color: Color for bullish mid trend lines (default: lime).
Bearish Color: Color for bearish mid trend lines (default: maroon).
Style: Line style (default: dashed).
Short Trend Line Settings
Length: Number of bars for short-term pivot points (default: 9).
Show/Hide: Toggle visibility of short trend lines (default: enabled).
Bullish Color: Color for bullish short trend lines (default: teal).
Bearish Color: Color for bearish short trend lines (default: purple).
Style: Line style (default: dotted).
General Display Settings
Break Check Price: Selects the price type for breakout detection (Close, High, or Low; default: Close).
Show Previous Trendlines: Option to display historical main trend lines (default: disabled).
Label Size: Size of breakout labels (Tiny, Small, Normal, Large, Huge; default: Small).
Filter Settings
ADX Threshold: Minimum ADX value for trend strength confirmation (default: 25).
Volume MA Period: Period for the volume moving average (default: 20).
RSI Filter: Enable/disable RSI filtering (default: enabled).
RSI Upper Threshold: Upper RSI limit for overbought conditions (default: 65).
RSI Lower Threshold: Lower RSI limit for oversold conditions (default: 35).
4. Technical Calculations
The indicator relies on several technical calculations to ensure accuracy:
Pivot Points: Pivot highs and lows are detected using the ta.pivothigh and ta.pivotlow functions, with separate lengths for Main, Mid, and Short trend lines.
Slope Calculation: The slope of each trend line is calculated as the change in price divided by the change in bar index between two pivot points.
ADX Calculation: ADX is computed using a 14-period Directional Movement Index (DMI), with smoothing over 14 bars.
RSI Calculation: RSI is calculated over a 14-period lookback using the ta.rsi function.
Volume Moving Average: A simple moving average (SMA) of volume is used to determine if current volume exceeds the average.
5. Strict Mode Validation
To ensure the reliability of trend lines, the indicator employs a strict mode check:
For bearish trend lines, all prices between pivot points must remain below the projected trend line.
For bullish trend lines, all prices must remain above the projected trend line.
Post-pivot break checks ensure that no breakouts occur between pivot points, enhancing the validity of the trend line.
6. Trend Line Extension
Trend lines are dynamically extended forward until a breakout occurs. The extension logic:
Projects the trend line using the calculated slope.
Continuously validates the extension using strict mode checks.
Stops extension upon a breakout, fixing the trend line at the breakout point.
7. Alerts and Labels
Labels: Breakout labels are placed above (for bearish breakouts) or below (for bullish breakouts) the price bar. Labels include:
A prefix indicating the trend line type (B for Main, M for Mid, S for Short).
A suffix showing satisfied filters (e.g.,   for Volume, ADX, and RSI).
Alerts: Each breakout triggers a one-time alert per bar close, with a descriptive message indicating the trend line type and filters met.
Detailed Code Breakdown
1. Initialization and Inputs
The script begins by defining the indicator with indicator('Smart Trend Lines  ', overlay = true), ensuring it overlays on the price chart. Input settings are grouped into categories (Main, Mid, Short, General Display, Filters) for user convenience. Each input includes a tooltip in both English and Arabic, enhancing accessibility.
2. Technical Indicator Calculations
Volume MA: Calculated using ta.sma(volume, volPeriod) to compare current volume against the average.
ADX: Computed using custom dirmov and adx functions, which calculate the Directional Movement Index and smooth it over 14 periods.
RSI: Calculated with ta.rsi(close, rsiPeriod) over 14 periods.
Price Selection: The priceToCheck function selects the price type (Close, High, or Low) for breakout detection.
3. Pivot Detection
Pivot points are detected using ta.pivothigh and ta.pivotlow for each trend line type. The lookback period is set to the respective trend line length (e.g., 50 for Main, 21 for Mid, 9 for Short).
4. Trend Line Logic
For each trend line type (Main, Mid, Short):
Bearish Trend Lines: Identified when two consecutive pivot highs form a downward slope. The script validates the trend line using strict mode and post-pivot break checks.
Bullish Trend Lines: Identified when two consecutive pivot lows form an upward slope, with similar validation.
Trend lines are drawn using line.new, with separate lines for the initial segment (between pivots) and the extended segment (from the second pivot forward).
5. Breakout Detection and Labeling
Breakouts are detected when the selected price crosses the trend line level. The script checks:
Volume conditions (above average and aligned with candle direction).
ADX condition (above threshold).
RSI condition (within thresholds if enabled). Labels are created with label.new, and alerts are triggered with alert.
6. Trend Line Extension
The extendTrendline function dynamically updates the trend line’s endpoint unless a breakout occurs. It uses strict mode checks to ensure the trend line remains valid.
7. Previous Trend Lines
If enabled, previous main trend lines are stored in arrays (previousBearishStartLines, previousBullishTrendLines, etc.) and displayed on the chart, providing historical context.
Disclaimer:
The information and publications are not intended to be, nor do they constitute, financial, investment, trading, or other types of advice or recommendations provided or endorsed by TradingView.
FibonacciRetracementHi all!
This library will help you draw Fibonacci retracement levels (zones). The code is from my indicator "Fibonacci retracement" (). You can see that description for more information about the behaviour and example of how to use this library. The code is almost the same with the addition of alerts. If the alert frequency is 'alert.freq_once_per_bar_close' alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
Hope this is of help!
Library   "FibonacciRetracement" 
 ConcateAlerts(context) 
  Concatenates all alerts from the bar to one string (separated by new lines) and clears alert messages on the current bar.
  Parameters:
     context (Context) 
 AddAlert(context, message, unshiftInsteadOfPush) 
  Parameters:
     context (Context) 
     message (string) 
     unshiftInsteadOfPush (bool) 
 Range(context, structure, settings) 
  Will return values if new levels/zones should be drawn.
  Parameters:
     context (Context) : The 'Context' for the Fibonacci retracement.
     structure (Structure type from mickes/PriceAction/1) : The current 'Structure' from the 'MarketStructure' library.
     settings (Settings) : The 'Settings' object for the 'Context'.
  Returns: A tuple with the start and end pivot if new zones should be drawn, ' ' otherwise.
 DrawAll(context, settings, start, end) 
  Draws lines and labels for the zone. It will also set the 'Price' value that will be used for absolute positions.
  Parameters:
     context (Context) : The 'Context' for the Fibonacci retracement.
     settings (Settings) : The 'Settings' object for the 'Context'.
     start (Pivot type from mickes/PriceAction/1) 
     end (Pivot type from mickes/PriceAction/1) 
 AlertActive(context, settings) 
  Will alert for all zones that are active. If multiple alert messages are added they will be concatenated (separated by a new line) with a header saying how many messages the alert contains.
  Parameters:
     context (Context) : The 'Context' for the Fibonacci retracement. This contains the zones that will be alerted if price (wick or close according to the settings) enters it.
     settings (Settings) : The 'Settings' object for the 'Context'.
 TrendlineSettings 
  Holds all the values for 'TrendlineSettings'.
  Fields:
     Enabled (series bool) : If the trendline should be visible or not.
     Color (series color) : The color of the trendline.
     Style (series string) : The style of the trendline (as a string).
 GenericZonesSettings 
  Holds all the values for 'GenericZonesSettings', that will be applicable to all drawn objects.
  Fields:
     ExtendRight (series bool) : If all lines should extend to the right or not.
     Style (series string) : The style of all drawn lines
     Reverse (series bool) : If true, all lines will be reversed.
     Prices (series bool) : If price levels should be shown or not.
     Levels (series bool) : If levels should be shown or not.
     LevelsValue (series string) : Either 'Value' or 'Percent'. Defined if value or percentage should be shown.
     FontSize (series int) : The for size of the text in labels drawn.
     LabelsPosition (series string) : Coul be 'Left', 'Rigth' or 'Adapt'. 'Adapt' will try to adapt the labels position to the prices.
 ZoneSettings 
  Holds all the values for 'ZoneSettings'.
  Fields:
     Enabled (series bool) : If this zone is enabled or not.
     Level (series float) : The level of the zone.
     Color (series color) : The color that will be displayed.
     Price (series float) : The price of the level. Will be set internally.
 Settings 
  Holds all the values for 'Settings'.
  Fields:
     PivotLeftLength (series int) : The left length used to find pivots through the 'MarketStructure' library.
     PivotRightLength (series int) : The right length used to find pivots through the 'MarketStructure' library.
     Trendline (TrendlineSettings) : The settings for the 'Trendline' object.
     GenericZonesSettings (GenericZonesSettings) : The setting applicable to all zones.
     AlertFrequency (series string) : The frequency for the alerts. If 'alert.freq_once_per_bar_close', alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
     AlertPrice (series string) : The price that has to enter a zone. Can be 'Close' (the closing price) or 'Wick' (the whole candle needs to be in the zone).
     Zone1 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone2 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone3 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone4 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone5 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone6 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone7 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone8 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone9 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone10 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone11 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone12 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone13 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone14 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone15 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone16 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone17 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone18 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone19 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone20 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone21 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone22 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone23 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
     Zone24 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
 Context 
  Holds all the values for 'Context'.
  Fields:
     Lines (array) : All the drawn lines for the current 'Context'.
     Labels (array) : All the drawn labels for the current 'Context'.
     Boxes (array) : All the drawn boxes for the current 'Context'.
     Alerts (array) : All the alert messages on the current tick.
     Start (series int) : The start bar index of the current 'Context'.
Trendline Breakouts With Targets [ omerprıme ]Indicator Explanation (English)
This indicator is designed to detect trendline breakouts and provide early trading signals when the price breaks key support or resistance levels.
Trendline Detection
The indicator identifies recent swing highs and lows to construct dynamic trendlines.
These trendlines act as support in an uptrend and resistance in a downtrend.
Breakout Confirmation
When the price closes above a resistance trendline, the indicator generates a bullish breakout signal.
When the price closes below a support trendline, it generates a bearish breakout signal.
Filtering False Signals
To reduce false breakouts, additional conditions (such as candle confirmation, volume filters, or price momentum) can be applied.
Only significant and confirmed breakouts are highlighted.
Trading Logic
Buy signals are triggered when the price breaks upward through resistance with confirmation.
Sell signals are triggered when the price breaks downward through support with confirmation.






















