OPEN-SOURCE SCRIPT
ATR and Stochastics by Xeodiac

This script combines two popular indicators, the Average True Range (ATR) and the Stochastic Oscillator, into a single chart for enhanced trading insights. Here’s a breakdown of how it works and what it does:
What It Does:
Average True Range (ATR):
Measures market volatility by calculating the average range of price movement over a specified period.
The ATR is plotted in blue on its natural scale, helping you assess how volatile the market is.
Stochastic Oscillator:
A momentum indicator that compares a security's closing price to its price range over a specific period.
It calculates two lines:
%K Line (Green): Tracks the raw Stochastic value.
%D Line (Red): A smoothed moving average of the %K line.
These values are plotted on a percentage scale (0-100) to indicate overbought or oversold conditions.
Inputs:
ATR Length: Specifies the number of periods used for ATR calculation (default is 14).
Stochastic %K Length: Determines the period for finding the highest high and lowest low for the %K calculation (default is 14).
Stochastic %D Smoothing: Sets the smoothing factor for the %D line (default is 3).
Visual Output:
Blue Line: Represents the ATR, showing how much price moves on average over the given period.
Green Line: The %K line of the Stochastic Oscillator, showing momentum shifts in the market.
Red Line: The %D line of the Stochastic Oscillator, providing a smoothed perspective on momentum.
Use Case:
This script is useful for:
Assessing Market Volatility: Use the ATR to understand how active the market is.
Identifying Overbought/Oversold Levels: Use the Stochastic Oscillator to identify potential reversal points.
Combining Signals: Analyze both indicators together to align volatility and momentum for better trading decisions.
What It Does:
Average True Range (ATR):
Measures market volatility by calculating the average range of price movement over a specified period.
The ATR is plotted in blue on its natural scale, helping you assess how volatile the market is.
Stochastic Oscillator:
A momentum indicator that compares a security's closing price to its price range over a specific period.
It calculates two lines:
%K Line (Green): Tracks the raw Stochastic value.
%D Line (Red): A smoothed moving average of the %K line.
These values are plotted on a percentage scale (0-100) to indicate overbought or oversold conditions.
Inputs:
ATR Length: Specifies the number of periods used for ATR calculation (default is 14).
Stochastic %K Length: Determines the period for finding the highest high and lowest low for the %K calculation (default is 14).
Stochastic %D Smoothing: Sets the smoothing factor for the %D line (default is 3).
Visual Output:
Blue Line: Represents the ATR, showing how much price moves on average over the given period.
Green Line: The %K line of the Stochastic Oscillator, showing momentum shifts in the market.
Red Line: The %D line of the Stochastic Oscillator, providing a smoothed perspective on momentum.
Use Case:
This script is useful for:
Assessing Market Volatility: Use the ATR to understand how active the market is.
Identifying Overbought/Oversold Levels: Use the Stochastic Oscillator to identify potential reversal points.
Combining Signals: Analyze both indicators together to align volatility and momentum for better trading decisions.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.