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が提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。