Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

// This source code is subject to the terms of the Mozilla Public License 2.

0 at
https://mozilla.org/MPL/2.0/
// © daytraderph

//@version=4
study("Dynamic Range", overlay = true )
res=input(defval="D", type = input.resolution )

dayrange=high-low
r1=security(syminfo.tickerid,res,dayrange[1])
r2=security(syminfo.tickerid,res,dayrange[2])
r3=security(syminfo.tickerid,res,dayrange[3])
r4=security(syminfo.tickerid,res,dayrange[4])
r5=security(syminfo.tickerid,res,dayrange[5])
r6=security(syminfo.tickerid,res,dayrange[6])
r7=security(syminfo.tickerid,res,dayrange[7])
r8=security(syminfo.tickerid,res,dayrange[8])
r9=security(syminfo.tickerid,res,dayrange[9])
r10=security(syminfo.tickerid,res,dayrange[10])
r11=security(syminfo.tickerid,res,dayrange[11])
r12=security(syminfo.tickerid,res,dayrange[12])
oo = security(syminfo.tickerid, res, open ,barmerge.gaps_off,
barmerge.lookahead_on)
zone1= oo + ( r1 +r2 +r3 +r4 +r5 )/10
zone2= oo + ( r1 +r2 +r3 +r4+r5+r6+r7 +r8+r9+r10)/10/2
zone3= oo - ( r1 +r2 +r3 +r4 +r5 )/10
zone4 = oo- ( r1 +r2 +r3 +r4+r5+r6+r7 +r8+r9+r10)/10/2
z1=plot(zone1,title="Z1",color=color.green,linewidth=1,style=plot.style_circles)
z2=plot(zone2,title="Z2",color=color.green,linewidth=1,style=plot.style_circles)
z3=plot(zone3,title="Z3",color=color.red,linewidth=1,style=plot.style_circles)
z4=plot(zone4,title="Z4",color=color.red,linewidth=1,style=plot.style_circles)

fill(z1,z2,color=color.green,transp=50)
fill(z3,z4,color=color.red,transp=50)

buycondition= crossover(close,zone2)
sellcondition= crossunder(close,zone4)
alertcondition(buycondition or sellcondition , title='Alert for buy and sell ',
message="You got alert from zone indicator : {{exchange}}:{{ticker}}, Price =
{{close}}, Volume = {{volume}}")

You might also like