Professional Documents
Culture Documents
Warrior Trendline
Warrior Trendline
0 at
https://mozilla.org/MPL/2.0/
// © Nick
//@version=4
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
//////////////////////////////////////////////// EMA -
5/20/50/100/200 ///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
EMA5_Len = input(5, minval=1, title="EMA5_Length")
//EMA5_src = input(close, title="EMA5_Source")
//EMA5_offset = input(title="EMA5_Offset", type=input.integer, defval=0, minval=-
500, maxval=500)
EMA5_out = ema(close, EMA5_Len)
plot(showEMA5 ? EMA5_out:na, title="EMA5", color=color.green, offset=0,linewidth=2)
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
///////////////////////////////////// CENTRAL PIVOT RANGE
(CPR) //////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////
//HAlftrend
atr2 = atr(100) / 2
dev1 = channelDeviation * atr2
highPrice = high[abs(highestbars(amplitude))]
lowPrice = low[abs(lowestbars(amplitude))]
highma = sma(high, amplitude)
lowma = sma(low, amplitude)
if nextTrend == 1
maxLowPrice := max(lowPrice, maxLowPrice)
if trend1 == 0
if not na(trend1[1]) and trend1[1] != 0
up := na(down[1]) ? down : down[1]
arrowUp := up - atr2
else
up := na(up[1]) ? maxLowPrice : max(maxLowPrice, up[1])
atrHigh := up + dev1
atrLow := up - dev1
else
if not na(trend1[1]) and trend1[1] != 1
down := na(up[1]) ? up : up[1]
arrowDown := down + atr2
else
down := na(down[1]) ? minHighPrice : min(minHighPrice, down[1])
atrHigh := down + dev1
atrLow := down - dev1
ht = trend1 == 0 ? up : down
//@version=4
//INPUT
src = input(close, title="Source")
modeSwitch = input("Hma", title="Equity hack hull atr", options=["Hma", "Thma",
"Ehma"])
length = input(110, title="Length(180-200 for floating S/R , 55 for swing entry)")
switchColor = input(true, "Color Hull according to trend?")
candleCol = input(false,title="Color candles based on Hull's Trend?")
visualSwitch = input(true, title="Show as a Band?")
thicknesSwitch = input(1, title="Line Thickness")
transpSwitch = input(40, title="Band Transparency",step=5)
//FUNCTIONS
//HMA
HMA(_src, _length) => wma(2 * wma(_src, _length / 2) - wma(_src, _length),
round(sqrt(_length)))
//EHMA
EHMA(_src, _length) => ema(2 * ema(_src, _length / 2) - ema(_src, _length),
round(sqrt(_length)))
//THMA
THMA(_src, _length) => wma(wma(_src,_length / 3) * 3 - wma(_src, _length / 2) -
wma(_src, _length), _length)
//SWITCH
Mode(modeSwitch, src, len) =>
modeSwitch == "Hma" ? HMA(src, len) :
modeSwitch == "Ehma" ? EHMA(src, len) :
modeSwitch == "Thma" ? THMA(src, len/2) : na
//OUT
HULL = Mode(modeSwitch, src, length)
MHULL = HULL[0]
SHULL = HULL[2]
//COLOR
hullColor = switchColor ? (HULL > HULL[2] ? #00ff00 : #ff0000) : #ff9800
//PLOT
///< Frame
Fi1 = plot(MHULL, title="Equity hull M", color=hullColor, linewidth=thicknesSwitch,
transp=50)
Fi2 = plot(visualSwitch ? SHULL : na, title="Equity hull S", color=hullColor,
linewidth=thicknesSwitch, transp=50)
///< Ending Filler
fill(Fi1, Fi2, title="Band Filler", color=hullColor, transp=transpSwitch)
///BARCOLOR
barcolor(color = candleCol ? (switchColor ? hullColor : na) : na)
///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////
timeChange(period) =>
change(time(period))
float vwapValue = na
float std = na
float upperBandValue = na
float lowerBandValue = na
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////
/////////////////////////////////////////////////Life
Trendline//////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////
// // Lij_MC
// Input variables
// Trendline Extensions
a_Extension_Multiplier=
a_Extensions==" 25"? 1 :
a_Extensions==" 50"? 2 :
a_Extensions==" 75"? 3 :
a_Extensions==" 100"? 4 :
a_Extensions==" 150"? 6 :
a_Extensions==" 200"? 8 :
a_Extensions==" 300"? 12 :
a_Extensions==" 400"? 16 :
a_Extensions==" 500"? 20 :
a_Extensions==" 750"? 30 :
a_Extensions=="1000"? 40 :
a_Extensions=="Infinate"? 0 : na
if not na(a_line_color)
a_trendline := line.new(a_Bx, a_By, a_Axbis, a_Aybis, xloc.bar_time,
extend = a__xtend? extend.right : extend.none, color = a_line_color, style =
a_Line_Type, width = a_width)
[a_Bx, a_By, a_Axbis, a_Aybis, a_slope]
// Function to get trendline price for X bars ago ("0" = current value)
a_line_get_price(a__start_time,a__start_price,a__slope,a__lookback_period,a__log_ch
art) =>
var float a_current_price = 0.0
a_elapsed_time = (time-a__start_time)
a_current_price := a__log_chart?(a__start_price*exp((a_elapsed_time-
(a__lookback_period * a_bar_time)) * a__slope)):(a__start_price + (a_elapsed_time -
(a__lookback_period * a_bar_time)) * a__slope)
// Initialition of pseudo array to keep track of last 10 high and 10 low trendline
values
var int a_high_x0=0, var float a_high_y0=0.0, var float a_high_sl0=0.0
var int a_high_x1=0, var float a_high_y1=0.0, var float a_high_sl1=0.0
var int a_high_x2=0, var float a_high_y2=0.0, var float a_high_sl2=0.0
var int a_high_x3=0, var float a_high_y3=0.0, var float a_high_sl3=0.0
var int a_high_x4=0, var float a_high_y4=0.0, var float a_high_sl4=0.0
var int a_high_x5=0, var float a_high_y5=0.0, var float a_high_sl5=0.0
var int a_high_x6=0, var float a_high_y6=0.0, var float a_high_sl6=0.0
var int a_high_x7=0, var float a_high_y7=0.0, var float a_high_sl7=0.0
var int a_high_x8=0, var float a_high_y8=0.0, var float a_high_sl8=0.0
var int a_high_x9=0, var float a_high_y9=0.0, var float a_high_sl9=0.0
// If a new trendline is formed, shift all values in the array one place up and
forget the last values
if change(fixnan(a_high_point))!=0
a_high_x9:=a_high_x8, a_high_y9:=a_high_y8, a_high_sl9:=a_high_sl8
a_high_x8:=a_high_x7, a_high_y8:=a_high_y7, a_high_sl8:=a_high_sl7
a_high_x7:=a_high_x6, a_high_y7:=a_high_y6, a_high_sl7:=a_high_sl6
a_high_x6:=a_high_x5, a_high_y6:=a_high_y5, a_high_sl6:=a_high_sl5
a_high_x5:=a_high_x4, a_high_y5:=a_high_y4, a_high_sl5:=a_high_sl4
a_high_x4:=a_high_x3, a_high_y4:=a_high_y3, a_high_sl4:=a_high_sl3
a_high_x3:=a_high_x2, a_high_y3:=a_high_y2, a_high_sl3:=a_high_sl2
a_high_x2:=a_high_x1, a_high_y2:=a_high_y1, a_high_sl2:=a_high_sl1
a_high_x1:=a_high_x0, a_high_y1:=a_high_y0, a_high_sl1:=a_high_sl0
a_high_x0:=a_phx1, a_high_y0:=a_phy1, a_high_sl0:=a_slope_high
if change(fixnan(a_low_point))!=0
a_low_x9:=a_low_x8, a_low_y9:=a_low_y8, a_low_sl9:=a_low_sl8
a_low_x8:=a_low_x7, a_low_y8:=a_low_y7, a_low_sl8:=a_low_sl7
a_low_x7:=a_low_x6, a_low_y7:=a_low_y6, a_low_sl7:=a_low_sl6
a_low_x6:=a_low_x5, a_low_y6:=a_low_y5, a_low_sl6:=a_low_sl5
a_low_x5:=a_low_x4, a_low_y5:=a_low_y4, a_low_sl5:=a_low_sl4
a_low_x4:=a_low_x3, a_low_y4:=a_low_y3, a_low_sl4:=a_low_sl3
a_low_x3:=a_low_x2, a_low_y3:=a_low_y2, a_low_sl3:=a_low_sl2
a_low_x2:=a_low_x1, a_low_y2:=a_low_y1, a_low_sl2:=a_low_sl1
a_low_x1:=a_low_x0, a_low_y1:=a_low_y0, a_low_sl1:=a_low_sl0
a_low_x0:=a_plx1, a_low_y0:=a_ply1, a_low_sl0:=a_slope_low
a_cross_high1=
not a_Rising_Upper_Falling_Lower and a_high_sl1 * time > 0 ? 0 :
a_line_cross(close, a_high_x1, a_high_y1, a_high_sl1, log_chart)
a_cross_low1=
not a_Rising_Upper_Falling_Lower and a_low_sl1 * time < 0 ? 0 :
a_line_cross(close, a_low_x1, a_low_y1, a_low_sl1, log_chart)
a_cross_high2=
not a_Rising_Upper_Falling_Lower and a_high_sl2 * time > 0 ? 0 :
a_line_cross(close, a_high_x2, a_high_y2, a_high_sl2, log_chart)
a_cross_low2=
not a_Rising_Upper_Falling_Lower and a_low_sl2 * time < 0 ? 0 :
a_line_cross(close, a_low_x2, a_low_y2, a_low_sl2, log_chart)
a_cross_high3=
not a_Rising_Upper_Falling_Lower and a_high_sl3 * time > 0 ? 0 :
a_line_cross(close, a_high_x3, a_high_y3, a_high_sl3, log_chart)
a_cross_low3=
not a_Rising_Upper_Falling_Lower and a_low_sl3 * time < 0 ? 0 :
a_line_cross(close, a_low_x3, a_low_y3, a_low_sl3, log_chart)
a_cross_high4=
not a_Rising_Upper_Falling_Lower and a_high_sl4 * time > 0 ? 0 :
a_line_cross(close, a_high_x4, a_high_y4, a_high_sl4, log_chart)
a_cross_low4=
not a_Rising_Upper_Falling_Lower and a_low_sl4 * time < 0 ? 0 :
a_line_cross(close, a_low_x4, a_low_y4, a_low_sl4, log_chart)
a_cross_high5=
not a_Rising_Upper_Falling_Lower and a_high_sl5 * time > 0 ? 0 :
a_line_cross(close, a_high_x5, a_high_y5, a_high_sl5, log_chart)
a_cross_low5=
not a_Rising_Upper_Falling_Lower and a_low_sl5 * time < 0 ? 0 :
a_line_cross(close, a_low_x5, a_low_y5, a_low_sl5, log_chart)
a_cross_high6=
not a_Rising_Upper_Falling_Lower and a_high_sl6 * time > 0 ? 0 :
a_line_cross(close, a_high_x6, a_high_y6, a_high_sl6, log_chart)
a_cross_low6=
not a_Rising_Upper_Falling_Lower and a_low_sl6 * time < 0 ? 0 :
a_line_cross(close, a_low_x6, a_low_y6, a_low_sl6, log_chart)
a_cross_high7=
not a_Rising_Upper_Falling_Lower and a_high_sl7 * time > 0 ? 0 :
a_line_cross(close, a_high_x7, a_high_y7, a_high_sl7, log_chart)
a_cross_low7=
not a_Rising_Upper_Falling_Lower and a_low_sl7 * time < 0 ? 0 :
a_line_cross(close, a_low_x7, a_low_y7, a_low_sl7, log_chart)
a_cross_high8=
not a_Rising_Upper_Falling_Lower and a_high_sl8 * time > 0 ? 0 :
a_line_cross(close, a_high_x8, a_high_y8, a_high_sl8, log_chart)
a_cross_low8=
not a_Rising_Upper_Falling_Lower and a_low_sl8 * time < 0 ? 0 :
a_line_cross(close, a_low_x8, a_low_y8, a_low_sl8, log_chart)
a_cross_high9=
not a_Rising_Upper_Falling_Lower and a_high_sl9 * time > 0 ? 0 :
a_line_cross(close, a_high_x9, a_high_y9, a_high_sl9, log_chart)
a_cross_low9=
not a_Rising_Upper_Falling_Lower and a_low_sl9 * time < 0 ? 0 :
a_line_cross(close, a_low_x9, a_low_y9, a_low_sl9, log_chart)
a_long_break=
(a_trendline_nr > 9 ? a_cross_high9==1 or (a_select_breaks ? false :
a_cross_low9==1) : false) or
(a_trendline_nr > 8 ? a_cross_high8==1 or (a_select_breaks ? false :
a_cross_low8==1) : false) or
(a_trendline_nr > 7 ? a_cross_high7==1 or (a_select_breaks ? false :
a_cross_low7==1) : false) or
(a_trendline_nr > 6 ? a_cross_high6==1 or (a_select_breaks ? false :
a_cross_low6==1) : false) or
(a_trendline_nr > 5 ? a_cross_high5==1 or (a_select_breaks ? false :
a_cross_low5==1) : false) or
(a_trendline_nr > 4 ? a_cross_high4==1 or (a_select_breaks ? false :
a_cross_low4==1) : false) or
(a_trendline_nr > 3 ? a_cross_high3==1 or (a_select_breaks ? false :
a_cross_low3==1) : false) or
(a_trendline_nr > 2 ? a_cross_high2==1 or (a_select_breaks ? false :
a_cross_low2==1) : false) or
(a_trendline_nr > 1 ? a_cross_high1==1 or (a_select_breaks ? false :
a_cross_low1==1) : false) or
a_cross_high0==1 or (a_select_breaks ? false : a_cross_low0==1)
a_short_break=
(a_trendline_nr>9 ? (a_select_breaks ? false : a_cross_high9==-1) or
a_cross_low9==-1 : false) or
(a_trendline_nr>8 ? (a_select_breaks ? false : a_cross_high8==-1) or
a_cross_low8==-1 : false) or
(a_trendline_nr>7 ? (a_select_breaks ? false : a_cross_high7==-1) or
a_cross_low7==-1 : false) or
(a_trendline_nr>6 ? (a_select_breaks ? false : a_cross_high6==-1) or
a_cross_low6==-1 : false) or
(a_trendline_nr>5 ? (a_select_breaks ? false : a_cross_high5==-1) or
a_cross_low5==-1 : false) or
(a_trendline_nr>4 ? (a_select_breaks ? false : a_cross_high4==-1) or
a_cross_low4==-1 : false) or
(a_trendline_nr>3 ? (a_select_breaks ? false : a_cross_high3==-1) or
a_cross_low3==-1 : false) or
(a_trendline_nr>2 ? (a_select_breaks ? false : a_cross_high2==-1) or
a_cross_low2==-1 : false) or
(a_trendline_nr>1 ? (a_select_breaks ? false : a_cross_high1==-1) or
a_cross_low1==-1 : false) or
(a_select_breaks ? false : a_cross_high0==-1) or a_cross_low0==-1
// // Trendline Extensions
b_Extension_Multiplier=
b_Extensions==" 25"? 1 :
b_Extensions==" 50"? 2 :
b_Extensions==" 75"? 3 :
b_Extensions==" 100"? 4 :
b_Extensions==" 150"? 6 :
b_Extensions==" 200"? 8 :
b_Extensions==" 300"? 12 :
b_Extensions==" 400"? 16 :
b_Extensions==" 500"? 20 :
b_Extensions==" 750"? 30 :
b_Extensions=="1000"? 40 :
b_Extensions=="Infinate"? 0 : na
if not na(b_line_color)
b_trendline := line.new(b_Bx, b_By, b_Axbis, b_Aybis, xloc.bar_time,
extend = b__xtend? extend.right : extend.none, color = b_line_color, style =
b_Line_Type, width = b_width)
[b_Bx, b_By, b_Axbis, b_Aybis, b_slope]
// Function to get trendline price for X bars ago ("0" = current value)
b_line_get_price(b__start_time,b__start_price,b__slope,b__lookback_period,b__log_ch
art) =>
var float b_current_price = 0.0
b_elapsed_time = (time-b__start_time) // (time-b__start_time) //
Original v312
b_current_price := b__log_chart?(b__start_price*exp((b_elapsed_time-
(b__lookback_period * b_bar_time)) * b__slope)):(b__start_price + (b_elapsed_time -
(b__lookback_period * b_bar_time)) * b__slope)
// Initialition of pseudo array to keep track of last 10 high and 10 low trendline
values
var int b_high_x0=0, var float b_high_y0=0.0, var float b_high_sl0=0.0
var int b_high_x1=0, var float b_high_y1=0.0, var float b_high_sl1=0.0
var int b_high_x2=0, var float b_high_y2=0.0, var float b_high_sl2=0.0
var int b_high_x3=0, var float b_high_y3=0.0, var float b_high_sl3=0.0
var int b_high_x4=0, var float b_high_y4=0.0, var float b_high_sl4=0.0
var int b_high_x5=0, var float b_high_y5=0.0, var float b_high_sl5=0.0
var int b_high_x6=0, var float b_high_y6=0.0, var float b_high_sl6=0.0
var int b_high_x7=0, var float b_high_y7=0.0, var float b_high_sl7=0.0
var int b_high_x8=0, var float b_high_y8=0.0, var float b_high_sl8=0.0
var int b_high_x9=0, var float b_high_y9=0.0, var float b_high_sl9=0.0
// If a new trendline is formed, shift all values in the array one place up and
forget the last values
if change(fixnan(b_high_point))!=0
b_high_x9:=b_high_x8, b_high_y9:=b_high_y8, b_high_sl9:=b_high_sl8
b_high_x8:=b_high_x7, b_high_y8:=b_high_y7, b_high_sl8:=b_high_sl7
b_high_x7:=b_high_x6, b_high_y7:=b_high_y6, b_high_sl7:=b_high_sl6
b_high_x6:=b_high_x5, b_high_y6:=b_high_y5, b_high_sl6:=b_high_sl5
b_high_x5:=b_high_x4, b_high_y5:=b_high_y4, b_high_sl5:=b_high_sl4
b_high_x4:=b_high_x3, b_high_y4:=b_high_y3, b_high_sl4:=b_high_sl3
b_high_x3:=b_high_x2, b_high_y3:=b_high_y2, b_high_sl3:=b_high_sl2
b_high_x2:=b_high_x1, b_high_y2:=b_high_y1, b_high_sl2:=b_high_sl1
b_high_x1:=b_high_x0, b_high_y1:=b_high_y0, b_high_sl1:=b_high_sl0
b_high_x0:=b_phx1, b_high_y0:=b_phy1, b_high_sl0:=b_slope_high
if change(fixnan(b_low_point))!=0
b_low_x9:=b_low_x8, b_low_y9:=b_low_y8, b_low_sl9:=b_low_sl8
b_low_x8:=b_low_x7, b_low_y8:=b_low_y7, b_low_sl8:=b_low_sl7
b_low_x7:=b_low_x6, b_low_y7:=b_low_y6, b_low_sl7:=b_low_sl6
b_low_x6:=b_low_x5, b_low_y6:=b_low_y5, b_low_sl6:=b_low_sl5
b_low_x5:=b_low_x4, b_low_y5:=b_low_y4, b_low_sl5:=b_low_sl4
b_low_x4:=b_low_x3, b_low_y4:=b_low_y3, b_low_sl4:=b_low_sl3
b_low_x3:=b_low_x2, b_low_y3:=b_low_y2, b_low_sl3:=b_low_sl2
b_low_x2:=b_low_x1, b_low_y2:=b_low_y1, b_low_sl2:=b_low_sl1
b_low_x1:=b_low_x0, b_low_y1:=b_low_y0, b_low_sl1:=b_low_sl0
b_low_x0:=b_plx1, b_low_y0:=b_ply1, b_low_sl0:=b_slope_low
b_cross_high1=
not b_Rising_Upper_Falling_Lower and b_high_sl1 * time > 0 ? 0 :
b_line_cross(close, b_high_x1, b_high_y1, b_high_sl1, log_chart)
b_cross_low1=
not b_Rising_Upper_Falling_Lower and b_low_sl1 * time < 0 ? 0 :
b_line_cross(close, b_low_x1, b_low_y1, b_low_sl1, log_chart)
b_cross_high2=
not b_Rising_Upper_Falling_Lower and b_high_sl2 * time > 0 ? 0 :
b_line_cross(close, b_high_x2, b_high_y2, b_high_sl2, log_chart)
b_cross_low2=
not b_Rising_Upper_Falling_Lower and b_low_sl2 * time < 0 ? 0 :
b_line_cross(close, b_low_x2, b_low_y2, b_low_sl2, log_chart)
b_cross_high3=
not b_Rising_Upper_Falling_Lower and b_high_sl3 * time > 0 ? 0 :
b_line_cross(close, b_high_x3, b_high_y3, b_high_sl3, log_chart)
b_cross_low3=
not b_Rising_Upper_Falling_Lower and b_low_sl3 * time < 0 ? 0 :
b_line_cross(close, b_low_x3, b_low_y3, b_low_sl3, log_chart)
b_cross_high4=
not b_Rising_Upper_Falling_Lower and b_high_sl4 * time > 0 ? 0 :
b_line_cross(close, b_high_x4, b_high_y4, b_high_sl4, log_chart)
b_cross_low4=
not b_Rising_Upper_Falling_Lower and b_low_sl4 * time < 0 ? 0 :
b_line_cross(close, b_low_x4, b_low_y4, b_low_sl4, log_chart)
b_cross_high5=
not b_Rising_Upper_Falling_Lower and b_high_sl5 * time > 0 ? 0 :
b_line_cross(close, b_high_x5, b_high_y5, b_high_sl5, log_chart)
b_cross_low5=
not b_Rising_Upper_Falling_Lower and b_low_sl5 * time < 0 ? 0 :
b_line_cross(close, b_low_x5, b_low_y5, b_low_sl5, log_chart)
b_cross_high6=
not b_Rising_Upper_Falling_Lower and b_high_sl6 * time > 0 ? 0 :
b_line_cross(close, b_high_x6, b_high_y6, b_high_sl6, log_chart)
b_cross_low6=
not b_Rising_Upper_Falling_Lower and b_low_sl6 * time < 0 ? 0 :
b_line_cross(close, b_low_x6, b_low_y6, b_low_sl6, log_chart)
b_cross_high7=
not b_Rising_Upper_Falling_Lower and b_high_sl7 * time > 0 ? 0 :
b_line_cross(close, b_high_x7, b_high_y7, b_high_sl7, log_chart)
b_cross_low7=
not b_Rising_Upper_Falling_Lower and b_low_sl7 * time < 0 ? 0 :
b_line_cross(close, b_low_x7, b_low_y7, b_low_sl7, log_chart)
b_cross_high8=
not b_Rising_Upper_Falling_Lower and b_high_sl8 * time > 0 ? 0 :
b_line_cross(close, b_high_x8, b_high_y8, b_high_sl8, log_chart)
b_cross_low8=
not b_Rising_Upper_Falling_Lower and b_low_sl8 * time < 0 ? 0 :
b_line_cross(close, b_low_x8, b_low_y8, b_low_sl8, log_chart)
b_cross_high9=
not b_Rising_Upper_Falling_Lower and b_high_sl9 * time > 0 ? 0 :
b_line_cross(close, b_high_x9, b_high_y9, b_high_sl9, log_chart)
b_cross_low9=
not b_Rising_Upper_Falling_Lower and b_low_sl9 * time < 0 ? 0 :
b_line_cross(close, b_low_x9, b_low_y9, b_low_sl9, log_chart)
b_long_break=
(b_trendline_nr > 9 ? b_cross_high9==1 or (b_select_breaks ? false :
b_cross_low9==1) : false) or
(b_trendline_nr > 8 ? b_cross_high8==1 or (b_select_breaks ? false :
b_cross_low8==1) : false) or
(b_trendline_nr > 7 ? b_cross_high7==1 or (b_select_breaks ? false :
b_cross_low7==1) : false) or
(b_trendline_nr > 6 ? b_cross_high6==1 or (b_select_breaks ? false :
b_cross_low6==1) : false) or
(b_trendline_nr > 5 ? b_cross_high5==1 or (b_select_breaks ? false :
b_cross_low5==1) : false) or
(b_trendline_nr > 4 ? b_cross_high4==1 or (b_select_breaks ? false :
b_cross_low4==1) : false) or
(b_trendline_nr > 3 ? b_cross_high3==1 or (b_select_breaks ? false :
b_cross_low3==1) : false) or
(b_trendline_nr > 2 ? b_cross_high2==1 or (b_select_breaks ? false :
b_cross_low2==1) : false) or
(b_trendline_nr > 1 ? b_cross_high1==1 or (b_select_breaks ? false :
b_cross_low1==1) : false) or
b_cross_high0==1 or (b_select_breaks ? false : b_cross_low0==1)
b_short_break=
(b_trendline_nr>9 ? (b_select_breaks ? false : b_cross_high9==-1) or
b_cross_low9==-1 : false) or
(b_trendline_nr>8 ? (b_select_breaks ? false : b_cross_high8==-1) or
b_cross_low8==-1 : false) or
(b_trendline_nr>7 ? (b_select_breaks ? false : b_cross_high7==-1) or
b_cross_low7==-1 : false) or
(b_trendline_nr>6 ? (b_select_breaks ? false : b_cross_high6==-1) or
b_cross_low6==-1 : false) or
(b_trendline_nr>5 ? (b_select_breaks ? false : b_cross_high5==-1) or
b_cross_low5==-1 : false) or
(b_trendline_nr>4 ? (b_select_breaks ? false : b_cross_high4==-1) or
b_cross_low4==-1 : false) or
(b_trendline_nr>3 ? (b_select_breaks ? false : b_cross_high3==-1) or
b_cross_low3==-1 : false) or
(b_trendline_nr>2 ? (b_select_breaks ? false : b_cross_high2==-1) or
b_cross_low2==-1 : false) or
(b_trendline_nr>1 ? (b_select_breaks ? false : b_cross_high1==-1) or
b_cross_low1==-1 : false) or
(b_select_breaks ? false : b_cross_high0==-1) or b_cross_low0==-1
// Trend Candles //
//UCS_Trend by ucsgears copy Trend Candles
//Interpretation of TTM Trend bars. It is really close to the actual.
haclose = ohlc4
haopen = 0.0
haopen := na(haopen[1]) ? (open + close) / 2 : (haopen[1] + haclose[1]) / 2
//hahigh = max(high, max(haopen, haclose))
//halow = min(low, min(haopen, haclose))
Trend_Candle_Change_Green = colorvalue ? 1 : 0
Trend_Candle_Change_Red = colorvalue ? 0 : 1
/////////
TF1 = timeframe.period
TF1_Menu = "S/R Zones"
TF1_VolMA1Input = 6
TF1_CalcFractalUp() =>
TF1_FractalUp = 0.0
TF1_FractalUp := TF1_Up ? TF1_High[3] : TF1_FractalUp[1]
TF1_FractalUp
TF1_CalcFractalDown() =>
TF1_FractalDown = 0.0
TF1_FractalDown := TF1_Down ? TF1_Low[3] : TF1_FractalDown[1]
TF1_FractalDown
// Fractal Up Zones
TF1_CalcFractalUpLowerZone() =>
TF1_FractalUpLowerZone = 0.0
TF1_FractalUpLowerZone := TF1_Up and TF1_Close[3] > TF1_Open[3] ?
TF1_Close[3] :
TF1_Up and TF1_Close[3] < TF1_Open[3] ? TF1_Open[3] :
TF1_FractalUpLowerZone[1]
TF1_FractalUpLowerZone
TF1_CalcFractalUpUpperZone() =>
TF1_FractalUpUpperZone = 0.0
TF1_FractalUpUpperZone := TF1_Up and TF1_Close[3] > TF1_Open[3] ? TF1_High[3] -
TF1_Close[3] + TF1_High[3] :
TF1_Up and TF1_Close[3] < TF1_Open[3] ? TF1_High[3] - TF1_Open[3] +
TF1_High[3] :
TF1_FractalUpUpperZone[1]
TF1_FractalUpUpperZone
TF1_ResistanceUpperZone = TF1_FractalUpUpperZone
TF1_ResistanceLowerZone = TF1_FractalUpLowerZone
TF1_CalcFractalDownUpperZone() =>
TF1_FractalDownUpperZone = 0.0
TF1_FractalDownUpperZone := TF1_Down and TF1_Close[3] > TF1_Open[3] ?
TF1_Open[3] :
TF1_Down and TF1_Close[3] < TF1_Open[3] ? TF1_Close[3] :
TF1_FractalDownUpperZone[1]
TF1_FractalDownUpperZone
TF1_CalcFractalDownLowerZone() =>
TF1_FractalDownLowerZone = 0.0
TF1_FractalDownLowerZone := TF1_Down and TF1_Close[3] > TF1_Open[3] ?
TF1_Low[3] + TF1_Low[3] - TF1_Open[3] :
TF1_Down and TF1_Close[3] < TF1_Open[3] ? TF1_Low[3] + TF1_Low[3] -
TF1_Close[3] :
TF1_FractalDownLowerZone[1]
TF1_FractalDownLowerZone
TF1_SupportUpperZone = TF1_FractalDownUpperZone
TF1_SupportLowerZone = TF1_FractalDownLowerZone
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////
/////////////////////////////////////////
CPR/////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
/////////////////////////////////////////////////// PREVIOUS
DAY /////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
prevDayHigh = security(syminfo.tickerid, 'D', high[1], lookahead=true)
prevDayLow = security(syminfo.tickerid, 'D', low[1], lookahead=true)
plot( showpivot and prevDayHigh ? prevDayHigh : na, title="Prev Day High",
style=plot.style_circles, linewidth=2, color=color.red, transp=0)
plot( showpivot and prevDayLow ? prevDayLow : na, title="Prev Day Low",
style=plot.style_circles, linewidth=2, color=color.green, transp=0)