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.**
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。