OPEN-SOURCE SCRIPT
[FGL] Stochastic ATR Trend Indicator

This indicator:
INPUT PARAMETERS:
LOGIC FLOW
STRATEGIC INTERPRETATION
- Detects trend direction using ATR-based dynamic bands around SMA.
- Generates buy/sell signals using Stochastic crossover conditions filtered by trend.
- Colors candles to show trend direction.
- Plots a visual “trend zone” band on the chart.
INPUT PARAMETERS:
- Stochastic Length → Period for the stochastic oscillator.
- Smooth K and Smooth D → Smoothing parameters for %K and %D lines.
- ATR Length → Period used for SMA-based trend detection.
LOGIC FLOW
- Determine trend using long ATR-based SMA channel.
- Detect momentum change with Stochastic cross.
- Confirm both momentum and price align with trend.
- Generate buy/sell signal + change candle color.
STRATEGIC INTERPRETATION
- Best use: Trend-following momentum entries.
- Avoids: Countertrend false signals by filtering with trend value.
- Signals:
- Buy: In uptrend + bullish stochastic crossover.
- Sell: In downtrend + bearish stochastic crossover.
- Buy: In uptrend + bullish stochastic crossover.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.