OPEN-SOURCE SCRIPT
AS PRO Trendline Engine (SMC Style)

🧠 1. Trend Detection (SMA 9 + Candle Coloring)
The script calculates a 9-period Simple Moving Average (SMA 9).
Candles are colored based on price position:
Green → price above SMA (bullish trend)
Red → price below SMA (bearish trend)
👉 This acts as a basic trend filter.
⚡ 2. SMA 9 Cross Alerts
Generates signals when price:
Crosses above SMA 9 → potential bullish signal
Crosses below SMA 9 → potential bearish signal
👉 These are fast signals, but can be noisy without confirmation.
🧱 3. Market Structure (Pivots + Trendlines)
Detects:
Swing highs (pivot highs)
Swing lows (pivot lows)
Connects them to form:
Downtrend lines (high → high)
Uptrend lines (low → low)
Optionally draws parallel channels
👉 This represents market structure / price action geometry.
💥 4. Breakout Detection
Checks whether price breaks:
Above a trendline → bullish breakout
Below a trendline → bearish breakout
👉 Used for trend continuation or reversal signals.
📊 5. RSI Momentum Logic
Uses RSI (14) to detect:
Overbought → potential bearish reversal
Oversold → potential bullish reversal
👉 Mainly used for exit signals or momentum filtering.
🧬 6. EMA + SMA 200 (Higher-Timeframe Bias)
Includes:
EMA (short-term trend)
SMA 200 (long-term trend)
Generates signals when they cross.
👉 This acts as a macro trend filter.
🟩 7. Fair Value Gaps (FVG – SMC Core)
Detects inefficiencies between candles:
Bullish FVG → potential support zone
Bearish FVG → potential resistance zone
Tracks:
Creation of FVGs
Mitigation (when price fills the gap)
👉 This is the Smart Money / liquidity component of the script.
🚨 8. Alert System
The script includes alerts for:
SMA crosses
Trendline breakouts
RSI signals
EMA/SMA cross signals
FVG creation and mitigation
👉 However, each alert works independently, without a unified decision system.
🧩 What the Script Does Overall
It combines four key layers of analysis:
1. Trend
SMA 9
SMA 200
2. Momentum
RSI
3. Structure
Pivot-based trendlines
4. Liquidity
Fair Value Gaps (FVG)
⚠️ Key Limitation
The script produces many individual signals, but:
It does not prioritize them
It does not combine them
It does not generate a single high-quality trade decision
👉 In other words:
It’s a signal generator, not a decision engine.
The script calculates a 9-period Simple Moving Average (SMA 9).
Candles are colored based on price position:
Green → price above SMA (bullish trend)
Red → price below SMA (bearish trend)
👉 This acts as a basic trend filter.
⚡ 2. SMA 9 Cross Alerts
Generates signals when price:
Crosses above SMA 9 → potential bullish signal
Crosses below SMA 9 → potential bearish signal
👉 These are fast signals, but can be noisy without confirmation.
🧱 3. Market Structure (Pivots + Trendlines)
Detects:
Swing highs (pivot highs)
Swing lows (pivot lows)
Connects them to form:
Downtrend lines (high → high)
Uptrend lines (low → low)
Optionally draws parallel channels
👉 This represents market structure / price action geometry.
💥 4. Breakout Detection
Checks whether price breaks:
Above a trendline → bullish breakout
Below a trendline → bearish breakout
👉 Used for trend continuation or reversal signals.
📊 5. RSI Momentum Logic
Uses RSI (14) to detect:
Overbought → potential bearish reversal
Oversold → potential bullish reversal
👉 Mainly used for exit signals or momentum filtering.
🧬 6. EMA + SMA 200 (Higher-Timeframe Bias)
Includes:
EMA (short-term trend)
SMA 200 (long-term trend)
Generates signals when they cross.
👉 This acts as a macro trend filter.
🟩 7. Fair Value Gaps (FVG – SMC Core)
Detects inefficiencies between candles:
Bullish FVG → potential support zone
Bearish FVG → potential resistance zone
Tracks:
Creation of FVGs
Mitigation (when price fills the gap)
👉 This is the Smart Money / liquidity component of the script.
🚨 8. Alert System
The script includes alerts for:
SMA crosses
Trendline breakouts
RSI signals
EMA/SMA cross signals
FVG creation and mitigation
👉 However, each alert works independently, without a unified decision system.
🧩 What the Script Does Overall
It combines four key layers of analysis:
1. Trend
SMA 9
SMA 200
2. Momentum
RSI
3. Structure
Pivot-based trendlines
4. Liquidity
Fair Value Gaps (FVG)
⚠️ Key Limitation
The script produces many individual signals, but:
It does not prioritize them
It does not combine them
It does not generate a single high-quality trade decision
👉 In other words:
It’s a signal generator, not a decision engine.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。