OPEN-SOURCE SCRIPT

TrendLine Toolkit w/ Breaks (Real-Time)

The TrendLine Toolkit script introduces an innovating capability by extending the conventional use of trendlines beyond price action to include oscillators and other technical indicators. This tool allows traders to automatically detect and display trendlines on any TradingView built-in oscillator or community-built script, offering a versatile approach to trend analysis. With breakout detection and real-time alerts, this script enhances the way traders interpret trends in various indicators.

🔲 Methodology

Trendlines are a fundamental tool in technical analysis used to identify and visualize the direction and strength of a price trend. They are drawn by connecting two or more significant points on a price chart, typically the highs or lows of consecutive price movements (pivots).

Drawing Trendlines:
  • Uptrend Line - Connects a series of higher lows. It signals an upward price trend.
  • Downtrend Line - Connects a series of lower highs. It indicates a downward price trend.

Support and Resistance:
  • Support Line - A trendline drawn under rising prices, indicating a level where buying interest is historically strong.
  • Resistance Line - A trendline drawn above falling prices, showing a level where selling interest historically prevails.

Identification of Trends:
  • Uptrend - Prices making higher highs and higher lows.
  • Downtrend - Prices making lower highs and lower lows.
  • Sideways (or Range-bound) - Prices moving within a horizontal range.


A trendline helps confirm the existence and direction of a trend, providing guidance in aligning with the prevailing market sentiment. Additionally, they are usually paired with breakout analysis, a breakout occurs when the price breaches a trendline. This signals a potential change in trend direction or an acceleration of the existing trend.

The script adapts this methodology to oscillators and other indicators. Instead of relying on price pivots, which can only be detected in retrospect, the script utilizes a trailing stop on the oscillator to identify potential swings in real-time, you may find more info about it here (SuperTrend toolkit). We detect swings or pivots simply by testing for crosses between the indicator and its trailing stop.



This approach enables the algorithm to detect trendlines between consecutive pivot highs or lows on the oscillator itself, providing a dynamic and immediate representation of trend dynamics.

🔲 Breakout Detection

The script goes beyond trendline creation by incorporating breakout detection directly within the oscillator. After identifying a trendline, the algorithm continuously monitors the oscillator for potential breakouts, signaling shifts in market sentiment.

สแนปชอต

🔲 Setup Guide

A simple example on one of my public scripts, Z-Score Heikin-Ashi Transformed

สแนปชอต
สแนปชอต
สแนปชอต

🔲 Settings

  • Source - Choose an oscillator source of which to base the Toolkit on.
  • Zeroing - The Mid-Line value of the oscillator, for example RSI & MFI use 50.
  • Sensitivity - Calibrates the Sensitivity of which TrendLines are detected, higher values result in more detections.


🔲 Alerts

  • Bearish TrendLine
  • Bullish TrendLine
  • Bearish Breakout
  • Bullish Breakout

    As well as the option to trigger 'any alert' call.


By integrating trendline analysis into oscillators, this Toolkit enhances the capabilities of technical analysis, bringing a dynamic and comprehensive approach to identifying trends, support/resistance levels, and breakout signals across various indicators.
breakoutsignalCentered OscillatorsChart patternssupport_and_resistanceSupport and ResistancetoolkittrendlineanalysisTrend Line Break

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

คำจำกัดสิทธิ์ความรับผิดชอบ