OPEN-SOURCE SCRIPT

Trend Break Targets [MarkitTick]

316
Trend Break Targets

Trend Break Targets is a technical analysis tool designed to assist traders in identifying trendline breakouts and projecting potential price targets based on market geometry. Unlike fully automated indicators that guess trendlines, this tool provides you with precise control by allowing you to manually Pivot Point the trendline to specific points in time, while automating the complex math of target projection and structure mapping.

Theoretical Basis & Concepts

This indicator is grounded in classic technical analysis principles found in foundational trading literature. It automates the following methodology:

Drawing a trend line between two key points to represent dynamic support or resistance.

Identifying a breakout when the price closes above or below this line, potentially signaling a change in trend.

Calculating a price target by measuring the vertical distance between the breakout line and the last high/low (pivot), then projecting that same distance in the direction of the breakout.

This concept is based on methods and "Measured Move" theories explained in classic books such as "Technical Analysis of Stock Trends" by Edwards & Magee, "Technical Analysis of the Financial Markets" by John Murphy, and in Thomas Bulkowski's Price Pattern Studies.

How It Works

Pivot Pointed Trendline Construction The script draws a trendline between two user-defined points in time (Start Date and End Date). It calculates the slope between these points and extends the line infinitely to the right, allowing you to define the exact structure (e.g., a resistance trendline on a wedge).

Breakout Detection The script monitors the "Price Source" (High, Low, or Close) relative to the extended trendline.

A Bullish Breakout (BC) occurs when the Close crosses above a bearish trendline.

A Bearish Breakout (BC) occurs when the Close crosses below a bullish trendline.

Dynamic Target Projection (The Math) Upon a confirmed breakout, the script automatically calculates three distinct targets by identifying the most significant "Swing Point" (Pivot) prior to the breakout.

Distance (D): The vertical distance between the Trendline and the Pivot Price at the specific bar where the pivot occurred.

Target 1 (T1): The Breakout Price +/- (Distance × 1.0). This represents a classic 1:1 measured move.

Target 2 (T2): The Breakout Price +/- (Distance × 1.618). Based on the Golden Ratio extension.

Target 3 (T3): The Breakout Price +/- (Distance × 2.618).

Market Structure (CHOCH) The script includes an optional Change of Character (CHOCH) module. This runs independently of the trendline logic, identifying local Swing Highs and Swing Lows based on the "Swing Detection Length." It plots dashed lines and labels to visualize immediate shifts in market structure.

How to Use This Tool

This is an interactive tool that requires user input to define the setup.

Identify a Setup: Locate a clear trend, wedge, or flag pattern on your chart.

Set Pivot Points: Go to the Indicator Settings. Input the exact Start Date and End Date corresponding to the two main touches of your trendline.

Monitor for Breakout: The script will extend the line. Wait for a "BC" label to appear.

Trade Management: Once "BC" prints, the T1, T2, and T3 lines will instantly render. These can be used as potential take-profit zones or areas to tighten stop-losses.

Settings & Configuration

Indicator Settings

Start/End Date: The timestamp Pivot Points for your trendline.

Price Source: Determines what price (High or Low) Pivot Points the line and triggers the breakout.

Pivot Left/Right: Adjusts the sensitivity for finding the "Pivot Before Break" used for target calculations.

Extend Target Line: How far forward the target lines are drawn.

Visual Style

Colors: Fully customizable colors for the Trendline, Breakout Labels, and each Target level (T1, T2, T3).

Gold Bullish Reversal
ảnh chụp nhanh
This analysis dissects a confirmed bullish reversal on Gold using a custom Trend Break system. The setup identifies a transition from a bearish corrective phase to bullish momentum, validated by a structural break and a geometric target projection.

Trend Identification (The Pivot Points) The descending white trendline serves as the primary dynamic resistance, defining the bearish correction.

Pivot Points: The line is drawn connecting two significant swing highs, marked by Label 1 and Label 2.

Logic: These points represent the "lower highs" characteristic of the previous downtrend. As long as price remained below this trajectory, the bearish bias was intact.

The Trigger: Breakout & Confirmation The transition occurs at the candle marked BC (Breakout Candle).

Breakout Criteria: The indicator logic dictates that a signal is only valid when the bar closes above the trendline. This filters out intraday wicks and ensures genuine buyer commitment.

CHOCH Confluence: Immediately following the breakout, a CHOCH (Change of Character) label appears. This signals a shift in market structure, indicating that the internal lower-high/lower-low sequence has been violated, adding probability to the reversal.

Target Projection: The Measured Move The vertical green lines (T1, T2) represent profit objectives derived from the depth of the prior move. The logic calculates the distance between the breakout line and the lowest pivot prior to the break.

T1 (Standard Target): This is a 1:1 projection of the pre-breakout volatility. We see price action initially stalling near this level, confirming it as a zone of interest.

T2 (Golden Ratio Extension): The second target is calculated as the initial distance multiplied by 1.618 (Fibonacci Golden Ratio). The chart shows the price rallying aggressively through T1 to tap the T2 zone, often considered an exhaustion or major take-profit level in harmonic extensions.

Conclusion Gold has successfully invalidated the 4-hour bearish trendline. The confluence of a confirmed close above resistance (BC) and a structural shift (CHOCH) provided a high-probability long setup. The price has now fulfilled the T2 (1.618) extension, suggesting traders should watch for consolidation or a reaction at this key Fibonacci resistance level.

Bearish Trendline Breakdown
ảnh chụp nhanh
The image displays a Bearish Trendline Breakdown on the Gold (XAUUSD) 4-hour chart. The indicator is actually functioning in "Low" mode here (connecting swing lows to form support), which triggers the bearish logic found in the code. Here is the step-by-step breakdown:

The Setup: Pivot Points & Trendline

Visual: The Blue Labels "1" and "2" connected by a white diagonal line.

Code Logic: These are the user-defined start and end points.

Pivot Point 1 (startDate): The starting pivot of the trendline.

Pivot Point 2 (endDate): The ending pivot.

Trendline: The code draws a line between these two points and extends it to the right (extend.right). In this specific image, the line acts as a Support Trendline.

The Trigger: Break Candle (BC)

Visual: The Red Label "BC" appearing just below the white trendline.

Code Logic: This is the execution signal. The code detects a "Down Break" (dnBreak) because the Price Source was likely set to "Low" and the candle's Close was lower than the Trendline Price at that specific bar (close < currLinePrice). This confirms the support level has been breached.

The Projection: Targets (T1 & T2)

Visual: The Green Labels "T1" and "T2" with dotted horizontal lines projected downward.

Code Logic: These are profit targets based on a "Measured Move."

Pivot Calculation: The script looks back for a recent "Pivot High" (the peak before the crash) to calculate the volatility/distance (dist) between that peak and the trendline.

T1 (Conservative): The price is projected downward by 1x that distance (currLinePrice - dist).

T2 (Extended): The price is projected downward by 1.618x that distance (Golden Ratio extension).

Market Context: CHOCH

Visual: The small Red/Orange "CHOCH" labels appearing above the price action.

Code Logic: This is a secondary confirmation system running independently of the trendline. It detects a Change of Character (structural shift). The red labels indicate a "Bearish CHOCH," meaning the price broke below a significant prior swing low (last_swing_low). This supports the bearish bias of the trendline break.

Disclaimer This tool is for educational and technical analysis purposes only. Breakouts can fail (fake-outs), and past geometric patterns do not guarantee future price action. Always manage risk and use this tool in conjunction with other forms of analysis.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.