DATE and ATR20 for practice using kojiro_indicators
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kattsu

//@version=5
indicator('USDJPY    100EMA(ATR20)     ATR20     DATE', precision=2, overlay=false)

//a=ATR20
length = input(20, title='length of ATR')
a = ta.ema(ta.tr, length)
plot(a, linewidth=2, color=color.new(color.blue, 0))


//b=100EMA of ATR
long = input(100, title='length of EMA(ATR20)')
b = ta.ema(a, long)
plot(b, linewidth=2, color=color.new(color.red, 0))

//size
si=input(size.normal,title="size(small,normal,large,huge,auto)")

//DATE
D = label.new(bar_index, y=0, text="DATE "+str.tostring(year) + '.' + str.tostring(month) + '.' + str.tostring(dayofmonth), textcolor=color.new(color.black, 0), size=si, style=label.style_none)
label.delete(D[1])


//Space
sp1 = input(20,title="space between DATE and ATR")
sp2 = input(40,title="space between DATE and 100EMA of ATR")
sp3 = input(60,title="space between DATE and USDJPY")

//ATR20
ar=math.round(a,precision=1) 
E = label.new(bar_index - sp1, y=0, text="ATR20= "+str.tostring(ar), textcolor=color.new(color.blue, 0), size=si, style=label.style_none)
label.delete(E[1])

//100EMA of ATR
br=math.round(b,precision=1)
F = label.new(bar_index - sp2, y=0, text="100EMA(ATR20)= "+str.tostring(br), textcolor=color.new(color.red, 0), size=si, style=label.style_none)
label.delete(F[1])

U=request.security("USDJPY","D",close)
Ur=math.round(U,precision=2)
G = label.new(bar_index - sp3, y=0, text="USDJPY= "+str.tostring(Ur), textcolor=color.new(color.black, 0), size=si, style=label.style_none)
label.delete(G[1])
