TradingView
Autarch_Capital
2020년 6월 10일 오전 10시 29분

HG Scalpius - ATR Up/Down Tick Highlight 

Micro E-mini S&P 500 Index FuturesCME

설명

HG Scalpius - ATR Up/Down Tick Highlight


This indicator highlights ATR(14) upticks (green) and downticks (red) and has the below application:
- If a new trend closing high (low) is made on a downtick in ATR, decreasing volatility mode turns on


If you come across or think of any other useful scripts for the HG Scalpius system please comment below!


Links to 2 previous HG Scalpius scripts:
- tradingview.com/script/qKLDMa0C-HG-Scalpius-Previous-Bar-Highlight/
- tradingview.com/script/5gURDd3V-HG-Scalpius-H-SS-Scan/


Happy trading!


Code:
study(title="Average True Range", shorttitle="ATR", overlay=false)

length = input(title="Length", defval=14, minval=1)
smoothing = input(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"])



ma_function(source, length) =>
if smoothing == "RMA"
rma(source, length)
else
if smoothing == "SMA"
sma(source, length)
else
if smoothing == "EMA"
ema(source, length)
else
wma(source, length)

ATR = ma_function(tr(true), length)
c = ATR >= ATR[1] ? color.lime : color.red

plot(ATR, title = "ATR", color=c, transp=0)


더보기