TradingView
kik369
29 Th11 2016 19:11

ATR Levels 

British Pound/U.S. DollarFXCM

Mô tả

ATR levels drawn on a chart as dynamic (can change throughout the day), straight lines.
Upper band = daily ATR in pips + daily low.
Lower band = daily high - daily ATR in pips.
Can be used as a reversal signal if there is a good level past ATR. Can go long/short from there.
Bình luận
ViSi0nZ
Repaints like crazy ?!
djmc
does it repaint the steps? or is it fixed? please reply
Investorito
Hi, I was looking at your code, but it seems like you need to calculate the ATR from the previous daily close.

You may want to add the first two lines of code and update your upperband and loweband variables.



myprevClose0 = close[1]
myprevClose = security(tickerid, 'D', myprevClose0)

upperband = myprevClose + dailyatr
lowerband = myprevClose -dailyatr
cpjwoods28
hey @Investorito,

study(title="ATR Levels", overlay=true)
len = input(14)
myatr = atr(len)
dailyatr = security(tickerid, 'D', myatr)
myprevClose0 = close
myprevClose = security(tickerid, 'D', myprevClose0)
upperband = myprevClose + dailyatr
lowerband = myprevClose -dailyatr
plot(upperband, color=#415189, linewidth=2)
plot(lowerband, color=#415189, linewidth=2)

does this script look right to you? Proof read would be appreciated!
Investorito
@cpjwoods28, I think that myprevclose needs to reference last close instead of current close (current bar). I'd change it to:

myprevClose0 = close[1]
cpjwoods28
@Investorito, oh yeah! thanks for getting back to me. Much appreciated!
YaminAlharbi
@cpjwoods28, could you please write it here after the edited .
brandob
Is there a way for these levels to set alerts on? Thanks!
TradeChampss
Do you have a newer version of this script?
TradeChampss
@TradeChampss, security(tickerid, 'D', myatr) doesnt work in newere versions on pinescript
Thêm nữa