This indicator combines three technical tools into a single price overlay: dual Exponential Moving Averages (EMA), Parabolic SAR (PSAR), and ATR-derived stop loss levels.
//@version=4
// Version 1.0 - jan 2020 - Bas Willemstijn
study(title="EMA-PSAR-ATR indicators [Numchuck]", shorttitle="EMA-PSAR-ATR", overlay=true)
// EMA indicator
dropn(src, n) =>
na(src[n]) ? na : src
xema(src, len) =>
mult = 2.0 / (len + 1.0)
res = float(na)
res := mult * src + (1.0 - mult) * nz(res[1], src)
res
length1 = input(9, title="Very Fast Length", minval=1)
length2 = input(21, title="Fast Length", minval=1)
src = input(close, type=input.source, title="Source")
dropCandles = input(1, minval=0, title="Drop first N candles")
price = dropn(src, dropCandles)
sig1 = xema(price, length1)
sig2 = xema(price, length2)
plot(sig1, title="9 day EMA", color=color.red, transp=0, linewidth=2)
plot(sig2, title="21 day EMA", color=color.green, transp=0, linewidth=2)
// ATR indicator
length = input(14, minval=1)
src1 = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50)
maLen = input(7, title="maLength")
basis = sma(src1, length)
dev = mult * atr(length)
upper = basis + dev
lower = basis - dev
bbr = (src1 - lower) / (upper - lower)
bbe = ema(bbr, maLen)
up = bbe[1] > bbe and bbe[2] < bbe[1] ? bbe : na
bt = bbe[1] < bbe and bbe[2] > bbe[1] ? bbe : na
highest_1 = highest(3)
topH = na(up) == 0 ? highest_1 : na
lowest_1 = lowest(3)
bottomL = na(bt) == 0 ? lowest_1 : na
tf = fixnan(topH)
bf = fixnan(bottomL)
btop = close > open ? close : open
bbot = close > open ? open : close
plot(tf, color=color.blue, style=plot.style_circles, linewidth=1, offset=-1, title="Bearish SL")
plot(bf, color=color.blue, style=plot.style_circles, linewidth=1, offset=-1, title="Bullish SL")
// PSAR
//Simply Enhances Default Parabolic SAR by creating Two Color Options, One for UpTrend, Other for DownTrend
//Ability To Turn On/Off The Up Trending Parabolic SAR, And The Down Trending Parabolic SAR
start = input(2, minval=0, maxval=10, title="Start - Default = 2 - Multiplied by .01")
increment = input(2, minval=0, maxval=10, title="Step Setting (Sensitivity) - Default = 2 - Multiplied by .01")
maximum = input(2, minval=1, maxval=10, title="Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10")
sus = input(true, "Show Up Trending Parabolic Sar")
sds = input(true, "Show Down Trending Parabolic Sar")
disc = input(false, title="Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2")
//"------Step Setting Definition------"
//"A higher step moves SAR closer to the price action, which makes a reversal more likely."
//"The indicator will reverse too often if the step is set too high."
//"------Maximum Step Definition-----")
//"The sensitivity of the indicator can also be adjusted using the Maximum Step."
//"While the Maximum Step can influence sensitivity, the Step carries more weight"
//"because it sets the incremental rate-of-increase as the trend develops"
startCalc = start * .01
incrementCalc = increment * .01
maximumCalc = maximum * .10
sarUp = sar(startCalc, incrementCalc, maximumCalc)
sarDown = sar(startCalc, incrementCalc, maximumCalc)
colUp = close >= sarDown ? color.lime : na
colDown = close <= sarUp ? color.red : na
plot(sus and sarUp ? sarUp : na, title="Up Trending SAR", style=plot.style_circles, linewidth=4, color=colUp)
plot(sds and sarDown ? sarDown : na, title="Up Trending SAR", style=plot.style_circles, linewidth=4, color=colDown)
Overview
EMA-PSAR-ATR Indicators [Numchuck] calculates fast and very fast EMAs (defaults 9 and 21) using a custom EMA function, plots color-coded Parabolic SAR dots for uptrends and downtrends with toggleable visibility, and computes upper and lower volatility bands using Average True Range (ATR) to mark potential bullish and bearish stop loss points directly on the chart.
Dual custom Exponential Moving Averages
Color-coded Parabolic SAR with toggle options
ATR-based volatility bands for stop loss levels
Customizable EMA lengths and SAR sensitivity parameters
Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10
int
2
maximum
Show Up Trending Parabolic Sar
bool
true
sus
Show all 14 settings
Setting
Type
Default
Variable
Show Down Trending Parabolic Sar
bool
true
sds
Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2
bool
false
disc
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator overlays trend-following Supertrend bands on the price chart using Average True Range calculations. It plots trailing stop lines, highlights active trend directions, and prints buy or sell shape labels when price closes across band thresholds. I
The MA Envelope indicator calculates upper and lower channel bands shifted by a user-defined percentage around a baseline moving average. It supports Simple Moving Average, Exponential Moving Average, and Weighted Moving Average calculation types. The script p
Trend Compass 4H plots a multi-EMA ribbon (10/21/50) along with higher-timeframe reference levels on the price chart. It classifies trend phase into six states and calculates a composite weighted trend score. The script detects RSI and MACD divergences, analyz
My Macro Cycle Indicator plots daily and weekly simple and exponential moving averages on the price chart, plus Pi Cycle and Mayer Multiple levels derived from the 200-day average. Optional toggles add support-band fills, a Keltner channel, CME futures gaps, a
This indicator plots a double-smoothed Supertrend baseline on the price chart, combining a Supertrend midline with WMA and EMA smoothing to show trend direction. Direction uses an ATR-scaled baseline slope with hysteresis, while percentile-ranked slope magnitu
This indicator overlays an all-in-one technical analysis toolkit on the price chart. It plots multiple moving averages, including standard EMAs, SMAs, and a Trend Regularity Adaptive Moving Average, alongside Bollinger Bands, Supertrend, Nadaraya-Watson envelo