OPEN-SOURCE SCRIPT

NVDA - Gaussian Channel Strategy v3.4

📌 Strategy Description: Gaussian Channel Trading Strategy for NVDA

Overview
The Gaussian Channel Strategy is a trend-following and momentum-based strategy that combines Gaussian filtering with Stochastic RSI crossovers to detect high-probability entry and exit points. This version is specifically optimized for NVDA stock, ensuring proper execution of orders with backtesting support.

🔹 Key Components
Gaussian Filter (Ehlers' Technique)
A low-lag smoothing filter that removes noise and highlights the primary market trend.
It constructs upper and lower bands to define potential support and resistance levels.
The midline (Gaussian Filter) helps determine bullish vs. bearish conditions.
Stochastic RSI for Entry Signals
Momentum indicator that helps identify overbought and oversold conditions.
Uses %K and %D crossovers to generate buy (bullish) and sell (bearish) signals.
Risk Management with Stop Loss & Take Profit
Stop Loss: Set at 2% below the entry price to limit downside risk.
Take Profit: Set at 5% above the entry price to lock in gains.
Ensures controlled risk-to-reward ratio.
📊 Trading Logic
Buy Entry Condition (Go Long)
Stochastic RSI crossover: %K crosses above %D (bullish momentum).
Gaussian Filter confirms an uptrend (filt > filt[1]).
Price is trading above the Gaussian Filter (close > filt).
Backtesting range is valid (between 2020 - 2069).
✅ If conditions are met:
→ Enter Long Position (strategy.entry("Long", strategy.long))
Sell Entry Condition (Go Short)
Stochastic RSI crossover: %K crosses below %D (bearish momentum).
Gaussian Filter confirms a downtrend (filt < filt[1]).
Price is trading below the Gaussian Filter (close < filt).
✅ If conditions are met:
→ Enter Short Position (strategy.entry("Short", strategy.short))
Exit Conditions
Stop Loss triggers when price moves 2% against position.
Take Profit triggers when price moves 5% in favor of the position.
Uses strategy.exit() to automatically manage risk.
🔹 Visual Indicators
✔ Gaussian Filter Midline (Blue): Determines trend direction.
✔ Upper Band (Green): Resistance level for potential reversals.
✔ Lower Band (Red): Support level for possible bounces.
✔ Bar Color Coding:

Green Bars: Price trading above Gaussian Filter (bullish trend).
Red Bars: Price trading below Gaussian Filter (bearish trend).
✔ Buy & Sell Markers (plotshape())
Green ⬆ (Buy Signals)
Red ⬇ (Sell Signals)
📈 Strategy Use Case
Best for trend-following traders who want smooth, noise-free signals.
Ideal for swing traders targeting 2-5% price moves on NVDA.
Reduces false breakouts by requiring both Gaussian trend confirmation and Stochastic RSI crossovers.
Works well on high-liquidity stocks like NVDA, especially in volatile conditions.
🚀 Summary
✅ Combines trend detection (Gaussian Filter) with momentum confirmation (Stochastic RSI).
✅ Automated buy/sell execution with visual confirmations.
✅ Risk-controlled strategy with Stop Loss (2%) and Take Profit (5%).
✅ Optimized for NVDA stock, with proper execution & capital allocation.

Aviso legal