You are on page 1of 13

//@version=4

study("5EMA-BB-Dem&Sup-VW-Bu&Se-_2.35&48&PD", overlay=true)

//BB-Dem&Sup-VW-Bu&Se-_2.35&48&PD

[Trend1, dir_1] = supertrend(3, 7)


[Trend2, dir_2] = supertrend(2, 14)
[Trend3, dir_3] = supertrend(1, 21)

Long = close > Trend1 and close > Trend2 and close > Trend3 and
crossover(rsi(close,14),60) and volume > sma(volume,20)
Short = close < Trend1 and close < Trend2 and close < Trend3 and
crossunder(rsi(close,14),40) and volume > sma(volume,20)

plotshape(Long, title="Long", text="Long", textcolor=color.white,


style=shape.labelup, location=location.belowbar, color=color.green, transp=0,
size=size.tiny)
plotshape(Short, title="Short", text="Short", textcolor=color.white,
style=shape.labeldown, location=location.abovebar, color=color.red, transp=0,
size=size.tiny)

//study(title="TRADEMASTER 2.35", shorttitle=" TRADEMASTER 2.35 ", overlay=true)


up15on = input(true, title="15 Minute Opening Range High")
down15on = input(true, title="15 Minute Opening Range Low")

is_newbar(res) => change(time(res)) != 0

adopt(r, s) => security(syminfo.tickerid, r, s)

//high_range = valuewhen(is_newbar('D'),high,0)
//low_range = valuewhen(is_newbar('D'),low,0)

high_rangeL = valuewhen(is_newbar('D'),high,0)
low_rangeL = valuewhen(is_newbar('D'),low,0)
diff = (high_rangeL-low_rangeL)/2.35
up15 = plot(up15on ? adopt('15', high_rangeL): na, color = #009900,
linewidth=1,style=plot.style_line)
down15 = plot(down15on ? adopt('15', low_rangeL): na, color = #ff0000,
linewidth=1,style=plot.style_line)

diffup15 = plot(up15on ? adopt('15', (high_rangeL+diff)): na, color = #009900,


linewidth=1,style=plot.style_line)
diffdown15 = plot(down15on ? adopt('15', (low_rangeL-diff)): na, color = #ff0000,
linewidth=1,style=plot.style_line)

//@version=4
///study(title="Supply and Demand Zones",shorttitle="Supply / Demand",overlay=true)

//Daily zones
//daily = input(title = "Daily",type = input.bool,defval=true)
//dopen =
security(syminfo.tickerid,'D',open,barmerge.gaps_off,barmerge.lookahead_on)
//dayrange=(high-low)
//dcol = color.red

//r1 = security(syminfo.tickerid,'D',dayrange)
//r2 = security(syminfo.tickerid, 'D', dayrange[1])
//r3 = security(syminfo.tickerid, 'D', dayrange[2])
//r4= security(syminfo.tickerid, 'D', dayrange[3])
//r5= security(syminfo.tickerid, 'D', dayrange[4])
//r6 = security(syminfo.tickerid, 'D', dayrange[5])
//r7 = security(syminfo.tickerid, 'D', dayrange[6])
//r8 = security(syminfo.tickerid, 'D', dayrange[7])
//r9= security(syminfo.tickerid, 'D', dayrange[8])
//r10= security(syminfo.tickerid, 'D', dayrange[9])

//adr_10 = (r1+r2+r3+r4+r5+r6+r7+r8+r9+r10) /10


//adr_9 = (r1+r2+r3+r4+r5+r6+r7+r8+r9) /9
//adr_8 = (r1+r2+r3+r4+r5+r6+r7+r8) /8
//adr_7 = (r1+r2+r3+r4+r5+r6+r7) /7
//adr_6 = (r1+r2+r3+r4+r5+r6) /6
//adr_5 = (r1+r2+r3+r4+r5) /5
//adr_4 = (r1+r2+r3+r4) /4
//adr_3 = (r1+r2+r3) /3
//adr_2= (r1+r2)/2
//adr_1 = r1

//adrhigh10 = dopen+(adr_10/2)
//adrhigh5 = dopen+(adr_5/2)
//adrlow5 = dopen-(adr_5/2)
//adrlow10 = dopen-(adr_10/2)

//dayh5 = plot( daily? adrhigh5 : na, color = dcol)


//dayh10 = plot( daily? adrhigh10 : na, color = dcol)
//dayl5 = plot( daily? adrlow5 : na, color = dcol)
//dayl10 = plot( daily? adrlow10 : na, color = dcol)
//fill(dayh5,dayh10 , color=dcol)
//fill(dayl5,dayl10,color=dcol)

//Weekly zones
weekly = input(title = "Weekly",type = input.bool,defval=true)
wopen = security(syminfo.tickerid,'W',open,barmerge.gaps_off,barmerge.lookahead_on)
weekrange=(high-low)
wcol = color.blue
wr1 = security(syminfo.tickerid,'W',weekrange)
wr2 = security(syminfo.tickerid, 'W', weekrange[1])
wr3 = security(syminfo.tickerid, 'W', weekrange[2])
wr4= security(syminfo.tickerid, 'W', weekrange[3])
wr5= security(syminfo.tickerid, 'W', weekrange[4])
wr6 = security(syminfo.tickerid, 'W', weekrange[5])
wr7 = security(syminfo.tickerid, 'W', weekrange[6])
wr8 = security(syminfo.tickerid, 'W', weekrange[7])
wr9= security(syminfo.tickerid, 'W', weekrange[8])
wr10= security(syminfo.tickerid, 'W', weekrange[9])

awr_10 = (wr1+wr2+wr3+wr4+wr5+wr6+wr7+wr8+wr9+wr10) /10


awr_9 = (wr1+wr2+wr3+wr4+wr5+wr6+wr7+wr8+wr9) /9
awr_8 = (wr1+wr2+wr3+wr4+wr5+wr6+wr7+wr8) /8
awr_7 = (wr1+wr2+wr3+wr4+wr5+wr6+wr7) /7
awr_6 = (wr1+wr2+wr3+wr4+wr5+wr6) /6
awr_5 = (wr1+wr2+wr3+wr4+wr5) /5
awr_4 = (wr1+wr2+wr3+wr4) /4
awr_3 = (wr1+wr2+wr3) /3
awr_2= (wr1+wr2)/2
awr_1 = wr1

awrhigh10 = wopen+(awr_10/2)
awrhigh5 = wopen+(awr_5/2)
awrlow5 = wopen-(awr_5/2)
awrlow10 = wopen-(awr_10/2)

weekh5 = plot( weekly? awrhigh5 : na, color = wcol)


weekh10 = plot( weekly? awrhigh10 : na, color = wcol)
weekl5 = plot( weekly? awrlow5 : na, color = wcol)
weekl10 = plot( weekly? awrlow10 : na, color = wcol)
fill(weekh5,weekh10,color=wcol)
fill(weekl5,weekl10,color=wcol)

//Monthly zones
monthly = input(title = "Monthly",type = input.bool,defval=true)
mopen = security(syminfo.tickerid,'M',open,barmerge.gaps_off,barmerge.lookahead_on)
monthrange=(high-low)
mcol = color.green

mr1 = security(syminfo.tickerid,'M',monthrange)
mr2 = security(syminfo.tickerid, 'M', monthrange[1])
mr3 = security(syminfo.tickerid, 'M', monthrange[2])
mr4= security(syminfo.tickerid, 'M', monthrange[3])
mr5= security(syminfo.tickerid, 'M', monthrange[4])
mr6 = security(syminfo.tickerid, 'M', monthrange[5])
mr7 = security(syminfo.tickerid, 'M', monthrange[6])
mr8 = security(syminfo.tickerid, 'M', monthrange[7])
mr9= security(syminfo.tickerid, 'M', monthrange[8])
mr10= security(syminfo.tickerid, 'M', monthrange[9])

amr_10 = (mr1+mr2+mr3+mr4+mr5+mr6+mr7+mr8+mr9+mr10) /10


amr_9 = (mr1+mr2+mr3+mr4+mr5+mr6+mr7+mr8+mr9) /9
amr_8 = (mr1+mr2+mr3+mr4+mr5+mr6+mr7+mr8) /8
amr_7 = (mr1+mr2+mr3+mr4+mr5+mr6+mr7) /7
amr_6 = (mr1+mr2+mr3+mr4+mr5+mr6) /6
amr_5 = (mr1+mr2+mr3+mr4+mr5) /5
amr_4 = (mr1+mr2+mr3+mr4) /4
amr_3 = (mr1+mr2+mr3) /3
amr_2= (mr1+mr2)/2
amr_1 = mr1

amrhigh10 = mopen+(amr_10/2)
amrhigh5 = mopen+(amr_5/2)
amrlom5 = mopen-(amr_5/2)
amrlom10 = mopen-(amr_10/2)

monthh5 = plot( monthly? amrhigh5 : na, color = mcol)


monthh10 = plot( monthly? amrhigh10 : na, color = mcol)
monthl5 = plot( monthly? amrlom5 : na, color = mcol)
monthl10 = plot( monthly? amrlom10 : na, color = mcol)
fill(monthh5,monthh10,color=mcol)
fill(monthl5,monthl10,color=mcol)

//@version=4

//study(title="Buy/Sell by stock setup", overlay=true)

source = input(defval=close, title="Source")

quickEMA = ema(close, 9)
plot(series=quickEMA, color=color.green, linewidth=1)
per1 = input(defval=27, minval=1, title="Fast period")
mult1 = input(defval=1.6, minval=0.1, title="Fast range")
per2 = input(defval=55, minval=1, title="Slow period")
mult2 = input(defval=2, minval=0.1, title="Slow range")
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ema(abs(x - x[1]), t)
smoothrng = ema(avrng, wper) * m
smoothrng
smrng1 = smoothrng(source, per1, mult1)
smrng2 = smoothrng(source, per2, mult2)
smrng = (smrng1 + smrng2) / 2
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r
:
x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
rngfilt
filt = rngfilt(source, smrng)
upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 :
nz(downward[1])
hband = filt + smrng
lband = filt - smrng
longCond = bool(na)
shortCond = bool(na)
longCond := source > filt and source > source[1] and upward > 0 or source > filt
and source < source[1] and upward > 0
shortCond := source < filt and source < source[1] and downward > 0 or source < filt
and source > source[1] and downward > 0
CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]
long = longCond and CondIni[1] == -1
short = shortCond and CondIni[1] == 1
plotshape(long, title="BUY", text="BUY", style=shape.labelup,
textcolor=color.white, size=size.auto, location=location.belowbar,
color=color.green, transp=0)
plotshape(short, title="SELL", text="SELL", style=shape.labeldown,
textcolor=color.white, size=size.auto, location=location.abovebar, color=color.red,
transp=0)
alertcondition(long, title="BUY", message="BUY")
alertcondition(short, title="SELL", message="SELL")
anchor = input(defval = "Session", title="Anchor Period", type=input.string)
MILLIS_IN_DAY = 86400000
dwmBarTime = timeframe.isdwm ? time : time("D")
if na(dwmBarTime)
dwmBarTime := nz(dwmBarTime[1])
var periodStart = time - time // zero
makeMondayZero(dayOfWeek) => (dayOfWeek + 5) % 7
isMidnight(t) =>
hour(t) == 0 and minute(t) == 0
isSameDay(t1, t2) =>
dayofmonth(t1) == dayofmonth(t2) and
month(t1) == month(t2) and
year(t1) == year(t2)
isOvernight() =>
not (isMidnight(dwmBarTime) or security(syminfo.tickerid, "D", isSameDay(time,
time_close), lookahead=true))
tradingDayStart(t) =>
y = year(t)
m = month(t)
d = dayofmonth(t)
timestamp(y, m, d, 0, 0)
numDaysBetween(time1, time2) =>
y1 = year(time1)
m1 = month(time1)
d1 = dayofmonth(time1)
y2 = year(time2)
m2 = month(time2)
d2 = dayofmonth(time2)
diff = abs(timestamp("GMT", y1, m1, d1, 0, 0) - timestamp("GMT", y2, m2, d2, 0,
0))
diff / MILLIS_IN_DAY
tradingDay = isOvernight() ? tradingDayStart(dwmBarTime + MILLIS_IN_DAY) :
tradingDayStart(dwmBarTime)
isNewPeriod() =>
isNew = false
if tradingDay != nz(tradingDay[1])
if anchor == "Session"
isNew := na(tradingDay[1]) or tradingDay > tradingDay[1]
if anchor == "Week"
DAYS_IN_WEEK = 7
isNew := makeMondayZero(dayofweek(periodStart)) +
numDaysBetween(periodStart, tradingDay) >= DAYS_IN_WEEK
if anchor == "Month"
isNew := month(periodStart) != month(tradingDay) or year(periodStart) !
= year(tradingDay)
if anchor == "Year"
isNew := year(periodStart) != year(tradingDay)
isNew
src = hlc3
sumSrc = float(na)
sumVol = float(na)
sumSrc := nz(sumSrc[1], 0)
sumVol := nz(sumVol[1], 0)
if isNewPeriod()
periodStart := tradingDay
sumSrc := 0.0
sumVol := 0.0
GLlabel=label.new(x=bar_index,y=close,text=" \n\n\n\n\n\n "+" stock setup" ,
style=label.style_label_up,
color=color.new(color.aqua,transp=100),
textcolor=color.new(color.aqua,transp=30),
size=size.normal)
label.delete(GLlabel[1])
if not na(src) and not na(volume)
sumSrc := sumSrc + src * volume
sumVol := sumVol + volume
vwapValue = sumSrc / sumVol
plot(vwapValue, title="VWAP", color=color.red, linewidth=3)

//EOS

// EMA
ema_01_len = input(10, title='Ema 1', step=1, type=input.integer)
ema_02_len = input(20, title='Ema 2', step=1, type=input.integer)

ema_03_len = input(61, title='Ema 3', step=1, type=input.integer)


ema_04_len = input(89, title='Ema 4', step=1, type=input.integer)
ema_05_len = input(200, title='Ema 5', step=1, type=input.integer)

ema_48H_len = input(48, title='Ema 48H', step=1, type=input.integer)


ema_48L_len = input(48, title='Ema 48L', step=1, type=input.integer)

ema_src = input(title="Source", type=input.source, defval=close)

// E moving average
ema_01 = ema(ema_src, ema_01_len)
ema_02 = ema(ema_src, ema_02_len)

ema_03 = ema(ema_src, ema_03_len)


ema_04 = ema(ema_src, ema_04_len)
ema_05 = ema(ema_src, ema_05_len)

ema_48H = ema(high, ema_48H_len)


ema_48L = ema(low, ema_48L_len)

//EMAs in Chart
plot(ema_01, title='ema_01', color=#00FF00, transp=0, style=plot.style_line,
linewidth=1)
plot(ema_02, title='ema_02', color=#ff0040, transp=0, style=plot.style_line,
linewidth=1)

plot(ema_03, title='ema_03', color=#ff0040, transp=0, style=plot.style_line,


linewidth=1)
plot(ema_04, title='ema_04', color=#ff0040, transp=0, style=plot.style_line,
linewidth=1)
plot(ema_05, title='ema_05', color=#ff0040, transp=0, style=plot.style_line,
linewidth=1)

plot(ema_48H, title='ema_48H', color=#00FF00, transp=0, style=plot.style_line,


linewidth=1)
plot(ema_48L, title='ema_48L', color=#ff0040, transp=0, style=plot.style_line,
linewidth=1)

// MA
ma_01_len = input(9, title='ma 1', step=1, type=input.integer)
ma_02_len = input(26, title='ma 2', step=1, type=input.integer)
ma_src = input(title="Source", type=input.source, defval=close)

// Moving Average
ma_01 = sma(ma_src, ma_01_len)
ma_02 = sma(ma_src, ma_02_len)
//MAs in Chart
plot(ma_01, title='ma_01', color=#00FF00, transp=0, style=plot.style_line,
linewidth=1)
plot(ma_02, title='ma_02', color=#ff0040, transp=0, style=plot.style_line,
linewidth=1)

//@version=3
//
// @mrSebastienC
// 2018-10-5
//study(title="Double Bollinger Bands", shorttitle="DBB", overlay=true)

//------------------------------ Inputs ------------------------------


lengthx = input(20, title="length")
srcx = close
std_dev_1 = input(1, title="BB1 stdDev")
std_dev_2 = input(2, title="BB2 stdDev")
offset = input(0, title="offset")

//------------------------------ Colors ------------------------------

color_gray = #eeeeee
color_green = #3fbe53
color_red = #ff4e3e

//------------------------------- Logic ------------------------------

median = sma(srcx, lengthx)


standard_deviation = stdev(srcx, lengthx)

standard_deviation_1 = standard_deviation * std_dev_1


upper_1 = median + standard_deviation_1
lower_1 = median - standard_deviation_1

standard_deviation_2 = standard_deviation * std_dev_2


upper_2 = median + standard_deviation_2
lower_2 = median - standard_deviation_2

//------------------------- Plotting & styling ------------------------

transp_bb_1 = 98
transp_bb_2 = 94

basis = plot(median, color=color_gray, transp=0, title="basis", offset=offset)

upper_band_1 = plot(upper_1, color=color_red, transp=transp_bb_1, title="BB1


upper", offset=offset)
lower_band_1 = plot(lower_1, color=color_green, transp=transp_bb_1, title="BB1
lower", offset=offset)

//fill(basis, upper_band_1, color=color_red, transp=transp_bb_1, title="background


BB1 upper")
//fill(basis, lower_band_1, color=color_green, transp=transp_bb_1,
title="background BB1 lower")

upper_band_2 = plot(upper_2, color=color_red, transp=transp_bb_2, title="BB2


upper", offset=offset)
lower_band_2 = plot(lower_2, color=color_green, transp=transp_bb_2, title="BB2
lower", offset=offset)

//fill(upper_band_1, upper_band_2, color=color_red, transp=transp_bb_2,


title="background BB2 upper")
//fill(lower_band_1, lower_band_2, color=color_green, transp=transp_bb_2,
title="background BB2 lower")

//------------------------------ Higher Inputs ------------------------------


lengthy = input(80, title="length-HighTFBB")
//srcx = close
standard_dev_HTF = input(2, title="HighTFBB stdDev")
//offset = input(0, title="offset")

//------------------------------ Colors ------------------------------

//color_gray = #eeeeee
//color_green = #3fbe53
//color_red = #ff4e3e

//------------------------------- Logic ------------------------------

medianHTF = sma(srcx, lengthy)


standard_deviation_H = stdev(srcx, lengthy)

standard_deviation_HTF = standard_deviation_H * standard_dev_HTF


upper_HTF = medianHTF + standard_deviation_HTF
lower_HTF = medianHTF - standard_deviation_HTF

//------------------------- Plotting & styling ------------------------

transp_bb_HTF = 94

basisHTF = plot(medianHTF, color=color_gray, transp=0, title="basisHTF",


offset=offset)

upper_band_HTF = plot(upper_HTF, color=color_red, transp=transp_bb_HTF,


title="HTFBB upper", offset=offset)
lower_band_HTF = plot(lower_HTF, color=color_green, transp=transp_bb_HTF,
title="HTFBB lower", offset=offset)

//@version=4
//study("SBER EMA Channel", overlay=true)
//plot(ema(high, 48), color=color.blue)
///plot(ema(low, 48), color=color.red)
// This source code is subject to the terms of the Mozilla Public License 2.0 at
https://mozilla.org/MPL/2.0/
// © FX365_Thailand

//Revision History
//v31.0
//Added label for each High/Low
//Added alert for crossing each High/Low
//v32.0
//Minor correction on labels

//@version=4
//Define indicator name
//study("High Low Yesterday & Today & Last week & Last
month",overlay=true,shorttitle="High Low Yesterday/Today/Last week/Last month")

//Users input
chk_yh = input(title="PDH", defval=true)
chk_yl = input(title="PDL", defval=true)

chk_2dh = input(title="2DH", defval=true)


chk_2dl = input(title="2DL", defval=true)

chk_th = input(title="High", defval=true)


chk_tl = input(title="Low", defval=true)
chk_lwh = input(title="last Week High", defval=true)
chk_lwl = input(title="last Week Low", defval=true)

chk_2wh = input(title="Week High2", defval=true)


chk_2wl = input(title="Week Low2", defval=true)

chk_lmh = input(title="Month High", defval=true)


chk_lml = input(title="Month Low", defval=true)
show_labels = input(title="Show Labels?", defval=true)
size_labels = input(title="Label font size", defval=size.normal, options =
[size.large,size.normal,size.small])
color_labels = input(title="Label font color", defval=color.black)

//Get High&Low Price


isess = session.regular
t = tickerid(syminfo.prefix, syminfo.ticker, session=isess)
igaps = barmerge.gaps_off
yesterdayHigh = security(t,"D",high[1],gaps=igaps, lookahead=barmerge.lookahead_on)
yesterdayLow = security(t,"D",low[1],gaps=igaps, lookahead=barmerge.lookahead_on)

dayHigh2 = security(t,"D",high[2],gaps=igaps, lookahead=barmerge.lookahead_on)


dayLow2 = security(t,"D",low[2],gaps=igaps, lookahead=barmerge.lookahead_on)

lastweekHigh = security(t,"W",high[1],gaps=igaps, lookahead=barmerge.lookahead_on)


lastweekLow = security(t,"W",low[1],gaps=igaps, lookahead=barmerge.lookahead_on)

weekHigh2 = security(t,"W",high[2],gaps=igaps, lookahead=barmerge.lookahead_on)


weekLow2 = security(t,"W",low[2],gaps=igaps, lookahead=barmerge.lookahead_on)

lastmonthHigh = security(t,"M",high[1],gaps=igaps, lookahead=barmerge.lookahead_on)


lastmonthLow = security(t,"M",low[1],gaps=igaps, lookahead=barmerge.lookahead_on)
todayHigh = security(t,"D",high[0],gaps=igaps, lookahead=barmerge.lookahead_on)
todayLow = security(t,"D",low[0],gaps=igaps, lookahead=barmerge.lookahead_on)

// Plot the other time frame's data


a=plot(timeframe.isintraday ? chk_yh ? yesterdayHigh : na : na, linewidth=1, title
= "PDH", color=color.green)
b=plot(timeframe.isintraday ? chk_yl ? yesterdayLow : na : na, linewidth=1, title =
"PDL", color=color.red)

i=plot(timeframe.isintraday ? chk_2dh ? dayHigh2 : na : na, linewidth=1, title =


"2DH", color=color.green)
j=plot(timeframe.isintraday ? chk_2dl ? dayLow2 : na : na, linewidth=1, title =
"2DL", color=color.red)

c=plot(timeframe.isintraday ? chk_th ? todayHigh : na : na, linewidth=1, title =


"High", color=color.black )
d=plot(timeframe.isintraday ? chk_tl ? todayLow : na : na, linewidth=1, title =
"Low",color=color.maroon )

e=plot(timeframe.isintraday ? chk_lwh ? lastweekHigh : na : timeframe.isdaily ?


chk_lwh ? lastweekHigh : na : na, linewidth=1, title = "Last Week's High",
color=color.navy )
f=plot(timeframe.isintraday ? chk_lwl ? lastweekLow : na : timeframe.isdaily ?
chk_lwl ? lastweekLow : na : na, linewidth=1, title = "Last Week's
Low",color=color.orange)

k=plot(timeframe.isintraday ? chk_2wh ? weekHigh2 : na : timeframe.isdaily ?


chk_2wh ? weekHigh2 : na : na, linewidth=1, title = "2 week High", color=color.navy
)
l=plot(timeframe.isintraday ? chk_2wl ? weekLow2 : na : timeframe.isdaily ? chk_2wh
? weekLow2 : na : na, linewidth=1, title = "2 week Low",color=color.orange)

g=plot(timeframe.isintraday ? chk_lmh ? lastmonthHigh : na : timeframe.isdaily ?


chk_lmh ? lastmonthHigh : na : timeframe.isweekly ? chk_lmh ? lastmonthHigh : na :
na, linewidth=1, title = "Last Month's High", color=color.purple )
h=plot(timeframe.isintraday ? chk_lml ? lastmonthLow : na: timeframe.isdaily ?
chk_lml ? lastmonthLow : na : timeframe.isweekly ? chk_lml ? lastmonthLow : na :
na, linewidth=1, title = "Last Month's Low",color=color.blue)
//Draw labels
if show_labels == true
if chk_yh == true and timeframe.isintraday == true
label YES_HIGH = label.new(bar_index, yesterdayHigh, "PDH",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(YES_HIGH[1])
if chk_yl == true and timeframe.isintraday == true
label YES_LOW = label.new(bar_index, yesterdayLow, "PDL",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(YES_LOW[1])

if chk_2dh == true and timeframe.isintraday == true


label YES_HIGH = label.new(bar_index, dayHigh2, "2DH",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(YES_HIGH[1])
if chk_2dl == true and timeframe.isintraday == true
label YES_LOW = label.new(bar_index, dayLow2, "2DL",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(YES_LOW[1])

if chk_th == true and timeframe.isintraday == true


label TOD_HIGH = label.new(bar_index, todayHigh, "High",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(TOD_HIGH[1])
if chk_tl == true and timeframe.isintraday == true
label TOD_LOW = label.new(bar_index, todayLow, "Low",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(TOD_LOW[1])

if chk_lwh == true and (timeframe.isintraday == true or timeframe.isdaily ==


true)
label LWEEK_HIGH = label.new(bar_index, lastweekHigh, "Previous Week High",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(LWEEK_HIGH[1])
if chk_lwl == true and (timeframe.isintraday == true or timeframe.isdaily ==
true)
label LWEEK_LOW = label.new(bar_index, lastweekLow, "Previous Week Low",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(LWEEK_LOW[1])

if chk_2wh == true and (timeframe.isintraday == true or timeframe.isdaily ==


true)
label WEEK_HIGH2 = label.new(bar_index, weekHigh2, "2Week High",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(WEEK_HIGH2[1])
if chk_2wl == true and (timeframe.isintraday == true or timeframe.isdaily ==
true)
label WEEK_LOW2 = label.new(bar_index, weekLow2, "2Week Low",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(WEEK_LOW2[1])
if chk_lmh == true and (timeframe.isintraday == true or timeframe.isdaily ==
true or timeframe.isweekly == true)
label LMONTH_HIGH = label.new(bar_index, lastmonthHigh, "Previous Month
High", style=label.style_none, textcolor = color_labels, size = size_labels,
textalign = text.align_right), label.delete(LMONTH_HIGH[1])
if chk_lml == true and (timeframe.isintraday == true or timeframe.isdaily ==
true or timeframe.isweekly == true)
label LMONTH_LOW = label.new(bar_index, lastmonthLow, "Previous Month Low",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(LMONTH_LOW[1])

You might also like