OPEN-SOURCE SCRIPT
KAI LINES

**KAI LINES — Smart Money Market Structure & Trade Plan Indicator**
KAI LINES is an all-in-one market structure and trade planning indicator designed to help traders identify potential trend shifts, continuation moves, entry areas, stop-loss levels, and profit targets directly on the chart.
The indicator tracks both **Major Market Structure** and **Internal Market Structure**, allowing traders to quickly understand the bigger market direction while also identifying shorter-term structural changes.
### Key Features
**Market Structure Detection**
* Identifies bullish and bearish structure breaks.
* Major structure is displayed as **BREAKOUT**.
* Internal structure is displayed as **BREAKOUT 2**.
* Tracks both **Change of Character (CHoCH)** and **Break of Structure (BoS)**.
**Automatic BUY & SELL Setups**
KAI LINES can generate trading setups when a market structure shift occurs.
Users can choose between:
* **CHoCH Only** — focuses on potential reversal setups.
* **CHoCH + BoS** — includes both reversal and continuation setups.
**Automatic Trade Plan**
Whenever a valid setup is detected, the indicator automatically calculates and displays:
* BUY or SELL Target Signal
* Primary Entry Area
* Secondary Pullback Entry Area
* Stop Loss Price
* Take Profit 1
* Take Profit 2
* Take Profit 3
* Take Profit 4
Profit targets are calculated using configurable **Risk-to-Reward (R) multiples**, allowing traders to customize their trade management style.
Default targets:
* TP1 = 1R
* TP2 = 2R
* TP3 = 3R
* TP4 = 4R
**Dynamic Stop Loss**
Stop Loss can be calculated using:
* ATR-based volatility
* Previous market structure / swing level
ATR length, ATR multiplier, additional SL buffer, and entry pullback depth can all be customized.
**External & Internal Trend Panel**
A simple trend dashboard displays the current condition of:
* External / Major Structure
* Internal / Minor Structure
This makes it easier to see whether both structures are aligned bullish, bearish, or conflicting.
**TradingView Alerts**
KAI LINES supports BUY and SELL alerts when a new setup is generated, making it possible to monitor multiple markets without constantly watching the chart.
### How to Read KAI LINES
**Bullish Setup**
A bullish structure shift can generate a BUY signal.
The indicator will automatically display:
Entry Area → Stop Loss → TP1 → TP2 → TP3 → TP4.
**Bearish Setup**
A bearish structure shift can generate a SELL signal.
The same trade-plan structure is automatically calculated in the opposite direction.
For higher-quality setups, traders can combine KAI LINES with market context such as trend direction, liquidity, support/resistance, higher-timeframe structure, volume, or fundamental catalysts.
### Important
KAI LINES is a technical analysis and trade-planning tool — it does not guarantee profitable trades.
Signals are evaluated on the **live candle and may change before the candle closes**. For more reliable confirmation, traders should evaluate signals after the candle has closed.
Always use proper risk management.
**KAI LINES — Structure. Entry. Risk. Target.**
KAI LINES is an all-in-one market structure and trade planning indicator designed to help traders identify potential trend shifts, continuation moves, entry areas, stop-loss levels, and profit targets directly on the chart.
The indicator tracks both **Major Market Structure** and **Internal Market Structure**, allowing traders to quickly understand the bigger market direction while also identifying shorter-term structural changes.
### Key Features
**Market Structure Detection**
* Identifies bullish and bearish structure breaks.
* Major structure is displayed as **BREAKOUT**.
* Internal structure is displayed as **BREAKOUT 2**.
* Tracks both **Change of Character (CHoCH)** and **Break of Structure (BoS)**.
**Automatic BUY & SELL Setups**
KAI LINES can generate trading setups when a market structure shift occurs.
Users can choose between:
* **CHoCH Only** — focuses on potential reversal setups.
* **CHoCH + BoS** — includes both reversal and continuation setups.
**Automatic Trade Plan**
Whenever a valid setup is detected, the indicator automatically calculates and displays:
* BUY or SELL Target Signal
* Primary Entry Area
* Secondary Pullback Entry Area
* Stop Loss Price
* Take Profit 1
* Take Profit 2
* Take Profit 3
* Take Profit 4
Profit targets are calculated using configurable **Risk-to-Reward (R) multiples**, allowing traders to customize their trade management style.
Default targets:
* TP1 = 1R
* TP2 = 2R
* TP3 = 3R
* TP4 = 4R
**Dynamic Stop Loss**
Stop Loss can be calculated using:
* ATR-based volatility
* Previous market structure / swing level
ATR length, ATR multiplier, additional SL buffer, and entry pullback depth can all be customized.
**External & Internal Trend Panel**
A simple trend dashboard displays the current condition of:
* External / Major Structure
* Internal / Minor Structure
This makes it easier to see whether both structures are aligned bullish, bearish, or conflicting.
**TradingView Alerts**
KAI LINES supports BUY and SELL alerts when a new setup is generated, making it possible to monitor multiple markets without constantly watching the chart.
### How to Read KAI LINES
**Bullish Setup**
A bullish structure shift can generate a BUY signal.
The indicator will automatically display:
Entry Area → Stop Loss → TP1 → TP2 → TP3 → TP4.
**Bearish Setup**
A bearish structure shift can generate a SELL signal.
The same trade-plan structure is automatically calculated in the opposite direction.
For higher-quality setups, traders can combine KAI LINES with market context such as trend direction, liquidity, support/resistance, higher-timeframe structure, volume, or fundamental catalysts.
### Important
KAI LINES is a technical analysis and trade-planning tool — it does not guarantee profitable trades.
Signals are evaluated on the **live candle and may change before the candle closes**. For more reliable confirmation, traders should evaluate signals after the candle has closed.
Always use proper risk management.
**KAI LINES — Structure. Entry. Risk. Target.**
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.