Professional Documents
Culture Documents
My File
My File
//@version=5
import TradingView/ta/7
showzz = input.string(defval='Show Both', title='Show Zig Zags', options=['Show Zig Zag 1', 'Show Zig Zag 2', 'Show Both',
'Show None'])
showhhll = input.string(defval='Show Both', title='Show HHLL', options=['Show HHLL 1', 'Show HHLL 2', 'Show Both', 'Show
None'])
m="Ab"
array.unshift(pointer, bindex)
array.unshift(pointer, value)
array.pop(pointer)
array.pop(pointer)
if array.size(pointer) == 0
else
if dir == 1 and value > array.get(pointer, 0) or dir == -1 and value < array.get(pointer, 0)
array.set(pointer, 0, value)
array.set(pointer, 1, bindex)
0.
dir2changed = ta.change(dir2)
if ph2 or pl2
if dir2changed
else
up=false
dn=false
dn2=false
if array.size(zigzag2) >= 6
line.delete(zzline2)
label.delete(zzlabel2)
zzline2
hhlltxt = dir2 == 1 ? array.get(zigzag2, 0) > array.get(zigzag2, 4) ? 'HH' : 'LH' : array.get(zigzag2, 0) < array.get(zigzag2,
4) ? 'LL' : 'HL'
zzlabel2
if dir2 == 1 and array.get(zigzag2, 0) > array.get(zigzag2, 4) or dir2 == 1 and array.get(zigzag2, 0) < array.get(zigzag2, 4)
up:=true
if dir2 == -1 and array.get(zigzag2, 0) < array.get(zigzag2, 4) or dir2 == -1 and array.get(zigzag2, 0) > array.get(zigzag2, 4)
dn:=true
d='d'
//plotshape(dn)
upc=ta.barssince(up)
dnc=ta.barssince(dn)
var upc2=0.0
var upc0=0.0
if up
buyslvo := line.new(bar_index-dnc, low[dnc], bar_index , high, color = color.rgb(118, 72, 245),width =2)
line.delete(buyslvo[1])
else
upc0:=line.get_x1(buyslvo)
upc2:=line.get_x2(buyslvo)
a='ul'
lrup=ta.barssince(dn)
lrup2=lrup/2
var downc=0.0
if dn
sellslvo := line.new(bar_index-upc, high[upc] , bar_index, low ,color = color.rgb(236, 67, 109),width =3)
line.delete(sellslvo[1])
else
downc2:=line.get_x1(sellslvo)
downc:=line.get_x2(sellslvo)
j=' O'
if up
line.delete(sellslvo)
if dn
line.delete(buyslvo)
is_firstbjKn =dn
day_lowbjKn = float(na)
day_lowbjKn := low
day_lowbjKn
else
day_lowbjKn := day_lowbjKn[1]
day_lowbjKn
day_lowbjKn := low
day_lowbjKn
is_first1bjKn =up
day_highbjKn = float(na)
H="ha"
else
day_highbjKn := day_highbjKn[1]
day_highbjKn := high
day_highbjKn
bc=ta.barssince(up)
lrdn0=downc-downc2
lrdn=bc
// plotshape(oha)
var sellv1z=0.0
var buyv1z=0.0
lrdn2=lrdn/2
hl=up
sumze = 0.0
sumze2 = 0.0
buyv1z :=sumze2//lrup2
if buyv1z<sellv1z
cv2:=true
if buyv1z>sellv1z
cv2:=false
///////////////////
k='b'
nn=lrdn2*2
lo=dn
var sellv1=0.0
var buyv1=0.0
if lo and bc>2
sumzeg = 0.0
sumze2g = 0.0
sellv1 :=sumzeg//lrdn2
buyv1 :=sumze2g//lrdn2
if buyv1<sellv1
cv:=true
if buyv1>sellv1
cv:=false
/////////dn 50%////////////////
//plotshape(lo)
ha=j+H+k
lrdnd=lrdn2
lrdn2d=lrdnd/2
lod=dn
var sellv1d=0.0
var buyv1d=0.0
sumzegd = 0.0
sumze2gd = 0.0
sellv1d :=sumzegd//lrdn2d
buyv1d :=sumze2gd//lrdn2d
if buyv1d<sellv1d
cvd:=true
if buyv1d>sellv1d
cvd:=false
/////////////////UP50%///////////////////////
lrupu=lrup2
lrup2u=lrupu/2
var sellv1zu=0.0
var buyv1zu=0.0
hlu=up
sumzeu = 0.0
sumze2u = 0.0
sellv1zu :=sumzeu///lrup2u
buyv1zu :=sumze2u//lrup2u
if buyv1zu<sellv1zu
cv2u:=true
if buyv1zu>sellv1zu
cv2u:=false
///////////////////////////
/////////////////////▲▼
tbc0=cv ? "volume.Hi":"volume.Low"
// tbc=tbc0+tbcd
// tbc3=tbc30+rd
///////////////////
N=m+d
tbcg0=cv2 ? "volume.Hi":"volume.Low"
✔ "
// ru= not cv2u and cv2 ?"":"✔
// tbc3g=tbc3g0+ru
////////////////////////////////
obcd=false
var rired =0
if up and soblock[1]
bsl330 :=high[dnc]
bsl430 := low[dnc]
soblock:= false
//rired:= boxlbu
// buysl2 := box.new(bar_index[_1], bsl3, bar_index+10, bsl4,bgcolor = color.rgb(241, 70, 155, 68), border_color =
color.rgb(252, 21, 129, 47))
array.push(shortBoxes30, drawShortBox30)
if array.size(shortBoxes30) > 0
top30 = box.get_top(sbox30)
bot30 = box.get_bottom(sbox30)
// if the two last closes are above the high of the bearish OB - Remove the OB
if low<top30
obcd:=true
if close <bot30
soblock:= false
array.remove(shortBoxes30, i30)
box.delete(sbox30)
updntrend:= true
else
box.set_right(sbox30, bar_index+8)
if dn
soblock:=true
obc=false
if dn and boblock[1]
boblock:= false
bsl3h :=low[upc]
// buysl2 := box.new(bar_index[_1], bsl3, bar_index+10, bsl4,bgcolor = color.rgb(241, 70, 155, 68), border_color =
color.rgb(252, 21, 129, 47))
array.push(shortBoxesh, drawShortBoxh)
if array.size(shortBoxesh) > 0
for ih = array.size(shortBoxesh) - 1 to 0 by 1
top3h4d0 = box.get_right(sboxh)
toph = box.get_top(sboxh)
both = box.get_bottom(sboxh)
if high> both
obc:=true
if close > toph
array.remove(shortBoxesh, ih)
box.delete(sboxh)
updntrend:= false
else
box.set_right(sboxh, bar_index+8)
if up
ut:=true
if dn
ut:=false
if up
boblock:= true
CVC=ut?tbcg:tbc0
tbc2gsp=ut ?'UP:▲':'DOWN:▼'
tbc2gs=ut ? #05ff6dc2:#ffde09
if barstate.islast
//i//f barstate.islast
//if barstate.islast