Professional Documents
Culture Documents
PDH PDL
PDH PDL
0 at
https://mozilla.org/MPL/2.0/
//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_th = input(title="High", defval=true)
chk_tl = input(title="Low", defval=true)
chk_lwh = input(title="Week High", defval=true)
chk_lwl = input(title="Week Low", 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)
//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_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, "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, "Week Low",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(LWEEK_LOW[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, "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, "Month Low",
style=label.style_none, textcolor = color_labels, size = size_labels, textalign =
text.align_right), label.delete(LMONTH_LOW[1])
//Alert condition
alertcondition(Al_co_yh, title="Cross over yesterday's High", message="Price
crosses over yesterday's High")
alertcondition(Al_cu_yl, title="Cross under yesterday's Low", message="Price
crosses under yesterday's Low")
alertcondition(Al_co_th, title="Cross over today's High", message="Price crosses
over today's High")
alertcondition(Al_cu_tl, title="Cross under today's Low", message="Price crosses
under today's Low")
alertcondition(Al_co_lwh, title="Cross over lastweek's High", message="Price
crosses over last week's High")
alertcondition(Al_cu_lwl, title="Cross under lastweek's Low", message="Price
crosses under last week's Low")
alertcondition(Al_co_lmh, title="Cross over lastmonth's High", message="Price
crosses over last month's High")
alertcondition(Al_cu_lml, title="Cross under lastmonth's Low", message="Price
crosses under last month's Low")