HiLo Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © VolvloV

//@version=4
study("HiLo Indicator")
tl = input(title="Time Length", defval=400)
fw = input(title="Fast WMA",defval=100)
lw = input(title="Long WMA",defval=300)

lo= close-lowest(close,tl)
hi= highest(close,tl)-close
a1 = wma(lo,fw)
a2 = wma(lo,lw)
a3 = wma(hi,fw)
a4 = wma(hi,lw)
p1 = plot(a1,color=color.lime)
p2 = plot(a2,color=color.yellow,transp=75)
p3 = plot(a3,color=color.red)
//p4 = plot(a4,color=color.red,transp=75)

color c_fill = color.new(wma(lo,fw) > wma(lo,lw) ? color.lime : color.yellow,80)
color c_fill2 = color.new(a1 > a3 ? color.lime : color.red,90)

fill(p1,p3,color=c_fill2,transp=90)

d = crossover(a1,a2) and hi>lo
e = crossover(a1,a3) 
f = crossunder(a1,a3)
g = crossover(a1,a2) and hi<lo
plotshape(d, style=shape.circle,color=color.green,size=size.tiny,location=location.bottom,text="Turn Around")
plotshape(g, style=shape.circle,color=color.yellow,size=size.tiny,location=location.top,text="Entry")
//plotshape(f, style=shape.circle,color=color.red,size=size.tiny,location=location.top,text="Bear X")

alertcondition(d, title='Turn Around', message='Possible Turn Around!')
alertcondition(e, title='Bull X', message='Bull X')
alertcondition(f, title='Bear X', message='Bear X')
alertcondition(g,title='Entry',message='Entry')


a1d = (a1+a1[1])/2
a3d = (a3+a3[1])/2
Area = sum(a1d-a3d,100)
//plot(Area/100)
