OPEN-SOURCE SCRIPT
Local Linear Slope Network [forexobroker]

Local Linear Slope Network runs four `ta.linreg` regressions at windows 10/20/40/80, computes each line's slope sign per bar, and only fires signals when at least N slopes agree AND the previous bar did NOT yet have agreement. A clean fractal trend-confirmation entry — most trend indicators use one length; this one votes across four.
🔶 ALGORITHM
For each window n in {10, 20, 40, 80}:
1. linreg_n = ta.linreg(close, n, 0)
2. slope_n = linreg_n − linreg_n[1]
3. slope-sign vote: count how many slopes are > 0 (upCount) and how many are < 0 (dnCount)
4. Agreement edge: at least N slopes agree AND previous bar agreement was below the same threshold
The "agreement edge" requirement gates the signal to a single bar at the regime change, not a stream of confirmations.
🔶 SIGNAL LOGIC
- Buy: upCount ≥ N AND previous bar upCount < N AND cooldown AND barstate.isconfirmed
- Sell: dnCount ≥ N AND previous bar dnCount < N AND cooldown AND barstate.isconfirmed
🔶 INPUTS
- Window 1/2/3/4 (defaults 10/20/40/80 — dyadic spacing)
- Min Slopes Agreeing (default 3 of 4)
- Signal Cooldown (default 8)
- Visual toggles for slowest line, dashboard, glow, colors
🔶 ALERTS
LLN Buy / Sell, Any Signal, Full Bull (4/4), Full Bear (4/4), Fast Pair Up/Dn, Webhook JSON.
🔶 LIMITATIONS
- ta.linreg internally is OLS regression — robust but assumes linear local trend. Works well on liquid trending instruments.
- Slope is computed as endpoint difference (linreg − linreg[1]) — sensitive to outlier bars.
- Slowest window (80 default) sets warmup.
- The dyadic spacing (10/20/40/80) is opinionated; tighter/wider spacings change signal frequency drastically.
🔶 ALGORITHM
For each window n in {10, 20, 40, 80}:
1. linreg_n = ta.linreg(close, n, 0)
2. slope_n = linreg_n − linreg_n[1]
3. slope-sign vote: count how many slopes are > 0 (upCount) and how many are < 0 (dnCount)
4. Agreement edge: at least N slopes agree AND previous bar agreement was below the same threshold
The "agreement edge" requirement gates the signal to a single bar at the regime change, not a stream of confirmations.
🔶 SIGNAL LOGIC
- Buy: upCount ≥ N AND previous bar upCount < N AND cooldown AND barstate.isconfirmed
- Sell: dnCount ≥ N AND previous bar dnCount < N AND cooldown AND barstate.isconfirmed
🔶 INPUTS
- Window 1/2/3/4 (defaults 10/20/40/80 — dyadic spacing)
- Min Slopes Agreeing (default 3 of 4)
- Signal Cooldown (default 8)
- Visual toggles for slowest line, dashboard, glow, colors
🔶 ALERTS
LLN Buy / Sell, Any Signal, Full Bull (4/4), Full Bear (4/4), Fast Pair Up/Dn, Webhook JSON.
🔶 LIMITATIONS
- ta.linreg internally is OLS regression — robust but assumes linear local trend. Works well on liquid trending instruments.
- Slope is computed as endpoint difference (linreg − linreg[1]) — sensitive to outlier bars.
- Slowest window (80 default) sets warmup.
- The dyadic spacing (10/20/40/80) is opinionated; tighter/wider spacings change signal frequency drastically.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.