EliCobra

TrendLine Toolkit w/ Breaks (Real-Time)

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

🔲 Methodology

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

Drawing Trendlines:
  • Uptrend Line - Connects a series of higher lows. It signals an upward price trend.
  • Downtrend Line - Connects a series of lower highs. It indicates a downward price trend.
Support and Resistance:
  • Support Line - A trendline drawn under rising prices, indicating a level where buying interest is historically strong.
  • Resistance Line - A trendline drawn above falling prices, showing a level where selling interest historically prevails.
Identification of Trends:
  • Uptrend - Prices making higher highs and higher lows.
  • Downtrend - Prices making lower highs and lower lows.
  • Sideways (or Range-bound) - Prices moving within a horizontal range.

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

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

type oscillator
    float o = Oscillator    Value
    float s = Trailing Stop Value

oscillator osc = oscillator.new()

bool l = ta.crossunder(osc.o, osc.s) => Utilized as a formed high
bool h = ta.crossover (osc.o, osc.s) => Utilized as a formed low

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

🔲 Breakout Detection

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


🔲 Setup Guide

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


🔲 Settings

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

🔲 Alerts

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

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

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

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?