Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StudyName = "BEST Long Term Levels Breakout Screener"
- ShortStudyName = "BEST LT levels Breakout Screener"
- study(StudyName, shorttitle=ShortStudyName, overlay=false, precision=6)
- prevLongTerm = input(title="⌚ Show previous Long Term Levels period", type=input.bool, defval=false)
- string sec00 = input(defval="XBTUSD", type=input.symbol)
- string sec01 = input(defval="ETHUSD", type=input.symbol)
- string sec02 = input(defval="ETHBTC", type=input.symbol)
- //string sec03 = input(defval="XRPUSD", type=input.symbol)
- //string sec04 = input(defval="LTCUSD", type=input.symbol)
- //////////////////////////
- //* COLOR CONSTANTS *//
- //////////////////////////
- AQUA = #00FFFFFF
- BLUE = #0000FFFF
- RED = #FF0000FF
- LIME = #00FF00FF
- GRAY = #808080FF
- DARKRED = #8B0000FF
- DARKGREEN = #006400FF
- GOLD = #FFD700
- WHITE = color.white
- // ——————————————— MORE Colors
- // MyGreenRaw = color.new(color.lime,0), MyGreenMedium = color.new(#00b300,0), MyGreenSemiDark = color.new(#009900,0), MyGreenDark = color.new(#006600,0), MyGreenDarkDark = color.new(#003300,0)
- // MyRedRaw = color.new(color.red,0), MyRedMedium = color.new(#cc0000,0), MyRedSemiDark = color.new(#990000,0), MyRedDark = color.new(#330000,0), MyRedDarkDark = color.new(#330000,0)
- // MyFuchsiaRaw = color.new(color.fuchsia,0), MyFuchsiaMedium = color.new(#c000c0,0), MyFuchsiaDark = color.new(#800080,0), MyFuchsiaDarkDark = color.new(#400040,0)
- // MyYellowRaw = color.new(color.yellow,0), MyYellowMedium = color.new(#c0c000,0), MyYellowDark = color.new(#808000,0), MyYellowDarkDark = color.new(#404000,0)
- // MyOrangeRaw = color.new(#ffa500,0), MyOrangeMedium = color.new(#cc8400,0), MyOrangeDark = color.new(#996300,0)
- // MyBlueRaw = color.new(#4985E7,0), MyBlueMedium = color.new(#4985E7,0)
- // MyGreenBackGround = color.new(#00FF00,93), MyRedBackGround = color.new(#FF0000,90)
- // Plots
- GREEN_LIGHT = color.new(color.green, 40)
- RED_LIGHT = color.new(color.red, 40)
- BLUE_LIGHT = color.new(color.aqua, 40)
- PURPLE_LIGHT = color.new(color.purple, 40)
- // ---------- Candle components and states
- NonZeroValue = 0.0000000001
- ///////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////// UTILITIES ///////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- bool is_newday = change(time("D")) != 0
- int bars_in_day = barssince(is_newday)
- f_securitys(_ticker)=>
- _r = timeframe.period
- _g = barmerge.gaps_off
- _l = barmerge.lookahead_on
- _close = security(symbol=_ticker, resolution=_r, expression=close, gaps=_g, lookahead=_l)
- _high = security(symbol=_ticker, resolution=_r, expression=high, gaps=_g, lookahead=_l)
- _low = security(symbol=_ticker, resolution=_r, expression=low, gaps=_g, lookahead=_l)
- prev = prevLongTerm ? 1 : 0
- weekH = security(_ticker, 'W', _high, lookahead=true)[prev]
- weekL = security(_ticker, 'W', _low, lookahead=true)[prev]
- monthH = security(_ticker, 'M', _high, lookahead=true)[prev]
- monthL = security(_ticker, 'M', _low, lookahead=true)[prev]
- quarterH = security(_ticker, '3M', _high, lookahead=true)[prev]
- quarterL = security(_ticker, '3M', _low, lookahead=true)[prev]
- yearH = security(_ticker, '12M', _high, lookahead=true)[prev]
- yearL = security(_ticker, '12M', _low, lookahead=true)[prev]
- // Conditions
- new_weekH = crossover(_close, weekH)
- new_weekL = crossunder(_close, weekL)
- new_monthH = crossover(_close, monthH)
- new_monthL = crossunder(_close, monthL)
- new_quarterH = crossover(_close, quarterH)
- new_quarterL = crossunder(_close, quarterL)
- new_yearH = crossover(_close, yearH)
- new_yearL = crossunder(_close, yearL)
- _color = iff(new_yearH, color.new(color.green, 0),
- iff(new_quarterH, color.new(color.green, 20),
- iff(new_monthH, color.new(color.green, 40),
- iff(new_weekH, color.new(color.green, 60),
- iff(new_yearL, color.new(color.red, 0),
- iff(new_quarterL, color.new(color.red, 20),
- iff(new_monthL, color.new(color.red, 40),
- iff(new_weekL, color.new(color.red, 60), color.new(color.orange, 50)))))))))
- [new_weekH, new_weekL,
- new_monthH, new_monthL,
- new_quarterH, new_quarterL,
- new_yearH, new_yearL, _color]
- lapos_x = timenow + round(change(time)*6)
- //f_color_label(_stackPos) => _stackPos ? color.new(color.green, 30) : color.new(color.red, 30)
- f_geom(_pr_a, _id, _color)=>
- var label la = na
- var counter = 0
- counter := counter + 1
- str_counter = ""//tostring(counter, "#") + ": "
- label.delete(la)
- la := label.new(
- x=lapos_x, y=ceil(_pr_a),
- text=str_counter + _id, xloc=xloc.bar_time, yloc=yloc.price, color=_color,
- style=label.style_labeldown, textcolor=color.black, size=size.small
- )
- [s00_weekH, s00_weekL, s00_monthH, s00_monthL, s00_quarterlyH, s00_quarterlyL, s00_yearlyH, s00_yearlyL, s00_color] = f_securitys(sec00)
- [s01_weekH, s01_weekL, s01_monthH, s01_monthL, s01_quarterlyH, s01_quarterlyL, s01_yearlyH, s01_yearlyL, s01_color] = f_securitys(sec01)
- [s02_weekH, s02_weekL, s02_monthH, s02_monthL, s02_quarterlyH, s02_quarterlyL, s02_yearlyH, s02_yearlyL, s02_color] = f_securitys(sec02)
- plotshape(s00_weekH or s00_weekL ? 0 : na , style=shape.square, location=location.absolute, color=s00_color, size = size.tiny)
- plotshape(s00_monthH or s00_monthL ? 0 : na , style=shape.circle, location=location.absolute, color=s00_color, size = size.tiny)
- plotshape(s00_quarterlyH or s00_quarterlyL ? 0 : na, style=shape.diamond, location=location.absolute, color=s00_color, size = size.tiny)
- plotshape(s00_yearlyH or s00_yearlyL ? 0 : na , style=shape.flag, location=location.absolute, color=s00_color, size = size.tiny)
- plotchar(not s00_weekH and not s00_weekL and not s00_monthH and not s00_monthL and not s00_quarterlyH and not s00_quarterlyL and not s00_yearlyH and not s00_yearlyL ? 0 : na,
- char='-',location=location.absolute, color=s00_color, size = size.normal)
- plotshape(s01_weekH or s01_weekL ? 1 : na , style=shape.square, location=location.absolute, color=s01_color, size = size.tiny)
- plotshape(s01_monthH or s01_monthL ? 1 : na , style=shape.circle, location=location.absolute, color=s01_color, size = size.tiny)
- plotshape(s01_quarterlyH or s01_quarterlyL ? 1 : na, style=shape.diamond, location=location.absolute, color=s01_color, size = size.tiny)
- plotshape(s01_yearlyH or s01_yearlyL ? 1 : na , style=shape.flag, location=location.absolute, color=s01_color, size = size.tiny)
- plotchar(not s01_weekH and not s01_weekL and not s01_monthH and not s01_monthL and not s01_quarterlyH and not s01_quarterlyL and not s01_yearlyH and not s01_yearlyL ? 1 : na,
- char='-',location=location.absolute, color=s01_color, size = size.normal)
- plotshape(s02_weekH or s02_weekL ? 2 : na , style=shape.square, location=location.absolute, color=s02_color, size = size.tiny)
- plotshape(s02_monthH or s02_monthL ? 2 : na , style=shape.circle, location=location.absolute, color=s02_color, size = size.tiny)
- plotshape(s02_quarterlyH or s02_quarterlyL ? 2 : na, style=shape.diamond, location=location.absolute, color=s02_color, size = size.tiny)
- plotshape(s02_yearlyH or s02_yearlyL ? 2 : na , style=shape.flag, location=location.absolute, color=s02_color, size = size.tiny)
- plotchar(not s02_weekH and not s02_weekL and not s02_monthH and not s02_monthL and not s02_quarterlyH and not s02_quarterlyL and not s02_yearlyH and not s02_yearlyL ? 2 : na,
- char='-',location=location.absolute, color=s02_color, size = size.normal)
- // right labels
- f_geom(0, sec00, s00_color)
- f_geom(1, sec01, s01_color)
- f_geom(2, sec02, s02_color)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement