OPEN-SOURCE SCRIPT
Aktualisiert [SM-021] Gaussian Trend System [Optimized]

This script is a comprehensive trend-following strategy centered around a Gaussian Channel. It is designed to capture significant market movements while filtering out noise during consolidation phases. This version (v2) introduces code optimizations using Pine Script v6 Arrays and a new Intraday Time Control feature.
1. Core Methodology & Math
The foundation of this strategy is the Gaussian Filter, originally conceptualized by @DonovanWall.
Gaussian Poles: Unlike standard moving averages (SMA/EMA), this filter uses "poles" (referencing signal processing logic) to reduce lag while maintaining smoothness.
Array Optimization: In this specific iteration, the f_pole function has been refactored to utilize Pine Script Arrays. This improves calculation efficiency and rendering speed compared to recursive variable calls, especially when calculating deep historical data.
Channel Logic: The strategy calculates a "Filtered True Range" to create High and Low bands around the main Gaussian line.
Long Entry: Price closes above the High Band.
Short Entry: Price closes below the Low Band.
2. Signal Filtering (Confluence)
To reduce false signals common in trend-following systems, the strategy employs a "confluence" approach using three additional layers:
Baseline Filter: A 200-period (customizable) EMA or SMA acts as a regime filter. Longs are only taken above the baseline; Shorts only below.
ADX Filter (Volatility): The Average Directional Index (ADX) is used to measure trend strength. If the ADX is below a user-defined threshold (default: 20), the market is considered "choppy," and new entries are blocked.
Momentum Check: A Stochastic RSI check ensures that momentum aligns with the breakout direction.
3. NEW: Intraday Session Filter
Per user requests, a time-based filter has been added to restrict trading activity to specific market sessions (e.g., the New York Open).
How it works: Users can toggle a checkbox to enable/disable the filter.
Configuration: You can define a specific time range (Default: 09:30 - 16:00) and a specific Timezone (Default: New York).
Logic: The strategy longCondition and shortCondition now check if the current bar's timestamp falls within this window. If outside the window, no new entries are generated, though existing trades are managed normally.
4. Risk Management
The strategy relies on volatility-based exits rather than fixed percentage stops:
ATR Stop Loss: A multiple of the Average True Range (ATR) is calculated at the moment of entry to set a dynamic Stop Loss.
ATR Take Profit: An optional Reward-to-Risk (RR) ratio can be set to place a Take Profit target relative to the Stop Loss distance.
Band Exit: If the trend reverses and price crosses the opposite band, the trade is closed immediately to prevent large drawdowns.
Credits & Attribution
Original Gaussian Logic: Developed by @DonovanWalll. This script utilizes his mathematical formula for the pole filters.
Strategy Wrapper & Array Refactor: Developed by @sebamarghella.
Community Request: The Intraday Session Filter was added to assist traders focusing on specific liquidity windows.
Disclaimer: This strategy is for educational purposes. Past performance is not indicative of future results. Please use the settings menu to adjust the Session Time and Risk parameters to fit your specific asset class.
1. Core Methodology & Math
The foundation of this strategy is the Gaussian Filter, originally conceptualized by @DonovanWall.
Gaussian Poles: Unlike standard moving averages (SMA/EMA), this filter uses "poles" (referencing signal processing logic) to reduce lag while maintaining smoothness.
Array Optimization: In this specific iteration, the f_pole function has been refactored to utilize Pine Script Arrays. This improves calculation efficiency and rendering speed compared to recursive variable calls, especially when calculating deep historical data.
Channel Logic: The strategy calculates a "Filtered True Range" to create High and Low bands around the main Gaussian line.
Long Entry: Price closes above the High Band.
Short Entry: Price closes below the Low Band.
2. Signal Filtering (Confluence)
To reduce false signals common in trend-following systems, the strategy employs a "confluence" approach using three additional layers:
Baseline Filter: A 200-period (customizable) EMA or SMA acts as a regime filter. Longs are only taken above the baseline; Shorts only below.
ADX Filter (Volatility): The Average Directional Index (ADX) is used to measure trend strength. If the ADX is below a user-defined threshold (default: 20), the market is considered "choppy," and new entries are blocked.
Momentum Check: A Stochastic RSI check ensures that momentum aligns with the breakout direction.
3. NEW: Intraday Session Filter
Per user requests, a time-based filter has been added to restrict trading activity to specific market sessions (e.g., the New York Open).
How it works: Users can toggle a checkbox to enable/disable the filter.
Configuration: You can define a specific time range (Default: 09:30 - 16:00) and a specific Timezone (Default: New York).
Logic: The strategy longCondition and shortCondition now check if the current bar's timestamp falls within this window. If outside the window, no new entries are generated, though existing trades are managed normally.
4. Risk Management
The strategy relies on volatility-based exits rather than fixed percentage stops:
ATR Stop Loss: A multiple of the Average True Range (ATR) is calculated at the moment of entry to set a dynamic Stop Loss.
ATR Take Profit: An optional Reward-to-Risk (RR) ratio can be set to place a Take Profit target relative to the Stop Loss distance.
Band Exit: If the trend reverses and price crosses the opposite band, the trade is closed immediately to prevent large drawdowns.
Credits & Attribution
Original Gaussian Logic: Developed by @DonovanWalll. This script utilizes his mathematical formula for the pole filters.
Strategy Wrapper & Array Refactor: Developed by @sebamarghella.
Community Request: The Intraday Session Filter was added to assist traders focusing on specific liquidity windows.
Disclaimer: This strategy is for educational purposes. Past performance is not indicative of future results. Please use the settings menu to adjust the Session Time and Risk parameters to fit your specific asset class.
Versionshinweise
Day of Week Filter (New in v4)- Function: Individual checkboxes for every day of the week (Mon-Sun).
- Usage: The strategy will only look for new entries on the checked days. This allows users to filter out days that are statistically poor performers for their specific asset class (e.g., avoiding Friday afternoons).
- Timezone Aware: Crucially, the "Day" calculation is linked to the Timezone setting in the Session Filter. This means if you trade the New York Session, the script calculates "Monday" based on New York time, ensuring accuracy regardless of your local physical location.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.