OPEN-SOURCE SCRIPT

Gaussian Channel Strategy

2 370
Gaussian Channel Strategy — User Guide
1. Concept
This strategy builds trades around the Gaussian Channel. Based on Pine Script v4 indicator originally published by Donovan Wall. With rework to v6 Pine Script and adding entry and exit functions.
The channel consists of three dynamic lines:


Line Formula Purpose
Filter (middle) N-pole Gaussian filter applied to price Market "equilibrium"
High Band Filter + (Filtered TR × mult) Dynamic upper envelope
Low Band Filter − (Filtered TR × mult) Dynamic lower envelope
A position is opened when price crosses a user-selected line in a user-selected direction.

When the smoothed True Range (Filtered TR) becomes negative, the raw bands can flip (High drops below Low).
The strategy automatically reorders them so the upper band is always above the lower band.
Visual colors still flip, but signals stay correct.

2. Entry Logic
Choose a signal line for longs and/or shorts: Filter, Upper band, or Lower band.

Choose a cross direction (Cross Up or Cross Down).

A signal remains valid for Lookback bars after the actual cross, as long as price is still on the required side of the line.

When the opposite signal appears, the current position is closed or reversed depending on Reverse on opposite.

3. Parameters

Group Setting Meaning
Source & Filter Source Price series used (close, hlc3, etc.)
Poles (N) Number of Gaussian filter poles (1-9). More poles ⇒ smoother but laggier
Sampling Period Main period length of the channel
Filtered TR Multiplier Width of the bands in fractions of smoothed True Range
Reduced Lag Mode Adds a lag-compensation term (faster but noisier)
Fast Response Mode Blends 1-pole & N-pole outputs for quicker turns
Signals Long → signal line / Short → signal line Which line generates signals
Long when price / Short when price Direction of the cross
Lookback bars for late entry Bars after the cross that still allow an entry
Trading Enable LONG/SHORT-side trades Turn each side on/off
On opposite signal: reverse True: reverse -- False: flat
Misc Start trading date Ignores signals before this timestamp (back-test focus)
4. Quick Start
Add the strategy to a chart. Default: hlc3, N = 4, Period = 144.

Select your signal lines & directions.
Example: trend trading – Long: Filter + Cross Up, Short: Filter + Cross Down.

Disable either side if you want long-only or short-only.

Tune Lookback (e.g. 3) to catch gaps and strong impulses.

Run Strategy Tester, optimise period / multiplier / stops (add strategy.exit blocks if needed).

When satisfied, connect alerts via TradingView webhooks or use the builtin broker panel.

5. Notes
Commission & slippage are not preset – adjust them in Properties → Commission & Slippage.

Works on any market and timeframe, but you should retune Sampling Period and Multiplier for each symbol.

No stop-loss / take-profit is included by default – feel free to add with strategy.exit.

Start trading date lets you back-test only recent history (e.g. last two years).

6. Disclaimer
This script is for educational purposes only and does not constitute investment advice.
Use entirely at your own risk. Back-test thoroughly and apply sound risk management before trading real capital.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.