Wci HH + LL
Wci HH + LL
Wci HH + LL
// Labels
var label labelll = na
var label labelhh = na
// Swing lines
var line line_up = na
var line line_down = na
// FUNCTIONS
obLabelText() =>
if(last_actual_label_hh_price < high)
"HH"
else
"LH"
//plot(last_actual_label_hh_price)
osLabelText() =>
if(last_actual_label_ll_price < low)
"HL"
else
"LL"
moveOverBoughtLabel() =>
label.set_x(labelhh, bar_index)
label.set_y(labelhh, high)
label.set_text(labelhh, obLabelText())
line.set_x1(line_up, bar_index)
line.set_y1(line_up, high)
// If we are overbought
if(isOverbought)
if(high >= hh)
hh := high
moveOverBoughtLabel()
laststate := 1
// If we are oversold
if(isOversold)
if(low <= ll)
ll := low
moveOversoldLabel()
laststate := 2
//If we are oversold and the last state was oversold, move the drawings to the
lowest price
if(laststate == 2 and isOversold)
if(low <= ll)
ll := low
moveOversoldLabel()
//@version=4
MchosenColor(c_)=> c_ == "aqua" ? color.aqua : c_ == "black" ? color.black : c_ ==
"blue" ? color.blue : c_ == "fuchsia" ? color.fuchsia : c_ == "gray" ? color.gray :
c_ == "green" ? color.green : c_ == "lime" ? color.lime : c_ == "maroon" ?
color.maroon : c_ == "navy" ? color.navy : c_ == "olive" ? color.olive : c_ ==
"orange" ? color.orange : c_ == "purple" ? color.purple : c_ == "red" ? color.red :
c_ == "silver" ? color.silver : c_ == "teal" ? color.teal : c_ == "white" ?
color.white : c_ == "yellow" ? color.yellow : color.black
MhigherTF = "M"
Mmy_color = input(title="Monthly Color", defval="red", options=["aqua", "black",
"blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange",
"purple", "red", "silver", "teal", "white", "yellow"])
MpRange = MprevHighHTF-MprevLowHTF
MpLevel = (MprevHighHTF + MprevLowHTF + MprevCloseHTF) / 3
if MpLevel[1] != MpLevel
line.set_x2(MR1L, bar_index)
line.set_x2(MS1L, bar_index)
line.set_x2(MR2L, bar_index)
line.set_x2(MS2L, bar_index)
line.set_x2(MR3L, bar_index)
line.set_x2(MS3L, bar_index)
line.set_x2(MR4L, bar_index)
line.set_x2(MS4L, bar_index)
line.set_x2(MR5L, bar_index)
line.set_x2(MS5L, bar_index)
line.set_x2(MR6L, bar_index)
line.set_x2(MS6L, bar_index)
line.set_x2(MR7L, bar_index)
line.set_x2(MS7L, bar_index)
line.set_x2(MR8L, bar_index)
line.set_x2(MS8L, bar_index)
line.set_extend(MR1L, extend.none)
line.set_extend(MpLine, extend.none)
line.set_extend(MS1L, extend.none)
line.set_extend(MR2L, extend.none)
line.set_extend(MS2L, extend.none)
line.set_extend(MR3L, extend.none)
line.set_extend(MS3L, extend.none)
line.set_extend(MR4L,extend.none)
line.set_extend(MS4L,extend.none)
line.set_extend(MR5L,extend.none)
line.set_extend(MS5L,extend.none)
line.set_extend(MR6L,extend.none)
line.set_extend(MS6L,extend.none)
line.set_extend(MR7L,extend.none)
line.set_extend(MS7L,extend.none)
line.set_extend(MR8L,extend.none)
line.set_extend(MS8L,extend.none)
label.delete(MR1LA[1])
label.delete(MS1LA[1])
label.delete(MR2LA[1])
label.delete(MS2LA[1])
label.delete(MpL[1])
label.delete(MR3LA[1])
label.delete(MS3LA[1])
label.delete(MR4LA[1])
label.delete(MS4LA[1])
label.delete(MR5LA[1])
label.delete(MS5LA[1])
label.delete(MR6LA[1])
label.delete(MS6LA[1])
label.delete(MR7LA[1])
label.delete(MS7LA[1])
label.delete(MR8LA[1])
label.delete(MS8LA[1])
line.delete(MR1L[1])
line.delete(MS1L[1])
line.delete(MR2L[1])
line.delete(MS2L[1])
line.delete(MpLine[1])
line.delete(MR3L[1])
line.delete(MS3L[1])
line.delete(MR4L[1])
line.delete(MS4L[1])
line.delete(MR5L[1])
line.delete(MS5L[1])
line.delete(MR6L[1])
line.delete(MS6L[1])
line.delete(MR7L[1])
line.delete(MS7L[1])
line.delete(MR8L[1])
line.delete(MS8L[1])
// WEEKLY PART
WchosenColor(c_)=> c_ == "aqua" ? color.aqua : c_ == "black" ? color.black : c_ ==
"blue" ? color.blue : c_ == "fuchsia" ? color.fuchsia : c_ == "gray" ? color.gray :
c_ == "green" ? color.green : c_ == "lime" ? color.lime : c_ == "maroon" ?
color.maroon : c_ == "navy" ? color.navy : c_ == "olive" ? color.olive : c_ ==
"orange" ? color.orange : c_ == "purple" ? color.purple : c_ == "red" ? color.red :
c_ == "silver" ? color.silver : c_ == "teal" ? color.teal : c_ == "white" ?
color.white : c_ == "yellow" ? color.yellow : color.black
WhigherTF = "W"
Wmy_color = input(title="Weekly Color", defval="blue", options=["aqua", "black",
"blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange",
"purple", "red", "silver", "teal", "white", "yellow"])
if WpLevel[1] != WpLevel
line.set_x2(WR1L, bar_index)
line.set_x2(WS1L, bar_index)
line.set_x2(WR2L, bar_index)
line.set_x2(WS2L, bar_index)
line.set_x2(WR3L, bar_index)
line.set_x2(WS3L, bar_index)
line.set_x2(WR4L, bar_index)
line.set_x2(WS4L, bar_index)
line.set_x2(WR5L, bar_index)
line.set_x2(WS5L, bar_index)
line.set_x2(WR6L, bar_index)
line.set_x2(WS6L, bar_index)
line.set_x2(WR7L, bar_index)
line.set_x2(WS7L, bar_index)
line.set_x2(WR8L, bar_index)
line.set_x2(WS8L, bar_index)
line.set_extend(WR1L, extend.none)
line.set_extend(WpLine, extend.none)
line.set_extend(WS1L, extend.none)
line.set_extend(WR2L, extend.none)
line.set_extend(WS2L, extend.none)
line.set_extend(WR3L, extend.none)
line.set_extend(WS3L, extend.none)
line.set_extend(WR4L,extend.none)
line.set_extend(WS4L,extend.none)
line.set_extend(WR5L,extend.none)
line.set_extend(WS5L,extend.none)
line.set_extend(WR6L,extend.none)
line.set_extend(WS6L,extend.none)
line.set_extend(WR7L,extend.none)
line.set_extend(WS7L,extend.none)
line.set_extend(WR8L,extend.none)
line.set_extend(WS8L,extend.none)
label.delete(WR1LA[1])
label.delete(WS1LA[1])
label.delete(WR2LA[1])
label.delete(WS2LA[1])
label.delete(WpL[1])
label.delete(WR3LA[1])
label.delete(WS3LA[1])
label.delete(WR4LA[1])
label.delete(WS4LA[1])
label.delete(WR5LA[1])
label.delete(WS5LA[1])
label.delete(WR6LA[1])
label.delete(WS6LA[1])
label.delete(WR7LA[1])
label.delete(WS7LA[1])
label.delete(WR8LA[1])
label.delete(WS8LA[1])
line.delete(WR1L[1])
line.delete(WS1L[1])
line.delete(WR2L[1])
line.delete(WS2L[1])
line.delete(WpLine[1])
line.delete(WR3L[1])
line.delete(WS3L[1])
line.delete(WR4L[1])
line.delete(WS4L[1])
line.delete(WR5L[1])
line.delete(WS5L[1])
line.delete(WR6L[1])
line.delete(WS6L[1])
line.delete(WR7L[1])
line.delete(WS7L[1])
line.delete(WR8L[1])
line.delete(WS8L[1])