0% found this document useful (0 votes)
8 views4 pages

New Support and Resistances

The document is a Pine Script code for a TradingView indicator called 'Frost® - Support and Resistances™'. It defines various parameters and functions to calculate and display support and resistance levels on price charts, including options for zones and labels. The script allows customization of line styles, colors, and the activation of support and resistance modules.

Uploaded by

darwincastro386
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

New Support and Resistances

The document is a Pine Script code for a TradingView indicator called 'Frost® - Support and Resistances™'. It defines various parameters and functions to calculate and display support and resistance levels on price charts, including options for zones and labels. The script allows customization of line styles, colors, and the activation of support and resistance modules.

Uploaded by

darwincastro386
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

//@version=6

indicator('Frost® - Support and Resistances™', shorttitle = 'Frost® - Support and


Resistances™ [1.4]', overlay = true, max_lines_count = 500, max_labels_count = 500,
max_boxes_count = 500, max_bars_back = 500, max_polylines_count = 100)

//-----------------------------------------------------------------------------}
//General Definition
//-----------------------------------------------------------------------------{

tradinggp = '🧊 Frost S/R Zones'

//-----------------------------------------------------------------------------}
//Autopilot Auto S/R
//-----------------------------------------------------------------------------{

label_loc = input.int(5, title = 'S/R Lines ', inline = 'PT0', group = tradinggp,
minval = 1, tooltip = '')
linelarge = input.int(355, title = '', inline = 'PT0', group = tradinggp, minval =
1, tooltip = '')
enableSR = input(true, 'S/R Levels', inline = 'AI10', group = tradinggp, tooltip =
'Activate Frost Support and Resistance module')
colorSup = input(color.new(#2157f3, 0), '', inline = 'AI10', group = tradinggp)
colorRes = input(color.new(#2157f3, 0), '', inline = 'AI10', group = tradinggp)
useZones = input(true, 'S/R Zones ', inline = 'AI11', group = tradinggp, tooltip =
'Shows support and resistance zones in the tf being worked on')
colorSup1 = input(color.new(#e91e63, 0), '', inline = 'AI11', group = tradinggp)
colorRes1 = input(color.new(#70e5e3, 0), '', inline = 'AI11', group = tradinggp)
colorfont = input(color.new(#ffffff, 0), '', inline = 'AI11', group = tradinggp)

useZones1 = false
useHLZones = input(false, 'High/Low Zones', inline = 'AI12', group = tradinggp,
tooltip = 'Shows the minimum and maximum zones of the TF that is being worked on.')

// Inputs

strengthSR = 2
lineStyle = string('Solid')
lineWidth = 1
zoneWidth = 2
expandSR = true

/// Functions
percWidth1(len, perc) =>
(ta.highest(len) - ta.lowest(len)) * perc / 100
// Get components
rb = 10
prd = 284
ChannelW = 10

style = lineStyle == 'Solid' ? line.style_solid : lineStyle == 'Dotted' ?


line.style_dotted : line.style_dashed
ph = ta.pivothigh(rb, rb)
pl = ta.pivotlow(rb, rb)
sr_levels = array.new_float(21, na)
prdhighest = ta.highest(prd)
prdlowest = ta.lowest(prd)
cwidth = percWidth1(prd, ChannelW)
zonePerc = percWidth1(300, zoneWidth)
aas = array.new_bool(41, true)
u1 = 0.0
u1 := nz(u1[1])
d1 = 0.0
d1 := nz(d1[1])
highestph = 0.0
highestph := highestph[1]
lowestpl = 0.0
lowestpl := lowestpl[1]
var sr_levs = array.new_float(21, na)
label hlabel = na
label.delete(hlabel[1])
label llabel = na
label.delete(llabel[1])
var sr_lines = array.new_line(21, na)
var sr_linesH = array.new_line(21, na)
var sr_linesL = array.new_line(21, na)
var sr_linesF = array.new_linefill(21, na)
var sr_labels = array.new_label(21, na)
if bool(ph) or bool(pl)
for x = 0 to array.size(sr_levels) - 1 by 1
array.set(sr_levels, x, na)
highestph := prdlowest
lowestpl := prdhighest
countpp = 0
for x = 0 to prd by 1
if na(close[x])
break
if not na(ph[x]) or not na(pl[x])
highestph := math.max(highestph, nz(ph[x], prdlowest), nz(pl[x],
prdlowest))
lowestpl := math.min(lowestpl, nz(ph[x], prdhighest), nz(pl[x],
prdhighest))
countpp := countpp + 1
if countpp > 40
break
if array.get(aas, countpp)
upl = (bool(ph[x]) ? high[x + rb] : low[x + rb]) + cwidth
dnl = (bool(ph[x]) ? high[x + rb] : low[x + rb]) - cwidth
u1 := countpp == 1 ? upl : u1
d1 := countpp == 1 ? dnl : d1
tmp = array.new_bool(41, true)
cnt = 0
tpoint = 0
for xx = 0 to prd by 1
if na(close[xx])
break
if not na(ph[xx]) or not na(pl[xx])
chg = false
cnt := cnt + 1
if cnt > 40
break
if array.get(aas, cnt)
if not na(ph[xx])
if high[xx + rb] <= upl and high[xx + rb] >= dnl
tpoint := tpoint + 1
chg := true
chg
if not na(pl[xx])
if low[xx + rb] <= upl and low[xx + rb] >= dnl
tpoint := tpoint + 1
chg := true
chg
if chg and cnt < 41
array.set(tmp, cnt, false)
if tpoint >= strengthSR
for g = 0 to 40 by 1
if not array.get(tmp, g)
array.set(aas, g, false)
if bool(ph[x]) and countpp < 21
array.set(sr_levels, countpp, high[x + rb])
if bool(pl[x]) and countpp < 21
array.set(sr_levels, countpp, low[x + rb])
// Plot
var line highest_ = na
line.delete(highest_)
var line lowest_ = na
line.delete(lowest_)
var line highest_fill1 = na
line.delete(highest_fill1)
var line highest_fill2 = na
line.delete(highest_fill2)
var line lowest_fill1 = na
line.delete(lowest_fill1)
var line lowest_fill2 = na
line.delete(lowest_fill2)
hi_col = close >= highestph ? colorSup : colorRes
lo_col = close >= lowestpl ? colorSup : colorRes
if enableSR
if useZones
highest_ := line.new(bar_index - 311, highestph, bar_index, highestph,
xloc.bar_index, expandSR ? extend.both : extend.none, hi_col, style, lineWidth)
lowest_ := line.new(bar_index - 311, lowestpl, bar_index, lowestpl,
xloc.bar_index, expandSR ? extend.both : extend.none, lo_col, style, lineWidth)
if useHLZones
highest_fill1 := line.new(bar_index - 311, highestph + zonePerc, bar_index,
highestph + zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
highest_fill2 := line.new(bar_index - 311, highestph - zonePerc, bar_index,
highestph - zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
lowest_fill1 := line.new(bar_index - 311, lowestpl + zonePerc, bar_index,
lowestpl + zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
lowest_fill2 := line.new(bar_index - 311, lowestpl - zonePerc, bar_index,
lowestpl - zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
linefill.new(highest_fill1, highest_fill2, color.new(hi_col, 80))
linefill.new(lowest_fill1, lowest_fill2, color.new(lo_col, 80))
if bool(ph) or bool(pl)
for x = 0 to array.size(sr_lines) - 1 by 1
array.set(sr_levs, x, array.get(sr_levels, x))
for x = 0 to array.size(sr_lines) - 1 by 1
line.delete(array.get(sr_lines, x))
line.delete(array.get(sr_linesH, x))
line.delete(array.get(sr_linesL, x))
linefill.delete(array.get(sr_linesF, x))
if bool(array.get(sr_levs, x)) and enableSR and useZones
line_col = close >= array.get(sr_levs, x) ? colorSup1 : colorRes1
array.set(sr_lines, x, line.new(bar_index - linelarge, array.get(sr_levs,
x), bar_index + 18, array.get(sr_levs, x), xloc.bar_index, expandSR ? extend.none:
extend.none, line_col, style, lineWidth))
if useZones1
array.set(sr_linesH, x, line.new(bar_index - linelarge,
array.get(sr_levs, x) + zonePerc, bar_index, array.get(sr_levs, x) + zonePerc,
xloc.bar_index, expandSR ? extend.none : extend.none, na))
array.set(sr_linesL, x, line.new(bar_index - linelarge,
array.get(sr_levs, x) - zonePerc, bar_index, array.get(sr_levs, x) - zonePerc,
xloc.bar_index, expandSR ? extend.none : extend.none, na))
array.set(sr_linesF, x, linefill.new(array.get(sr_linesH, x),
array.get(sr_linesL, x), color.new(line_col, 80)))
for x = 0 to array.size(sr_labels) - 1 by 1
label.delete(array.get(sr_labels, x))
if bool(array.get(sr_levs, x)) and enableSR and useZones
lab_loc = close >= array.get(sr_levs, x) ? label.style_none :
label.style_none
lab_col = close >= array.get(sr_levs, x) ? colorSup1 : colorRes1
array.set(sr_labels, x, label.new(bar_index + label_loc, array.get(sr_levs,
x), str.tostring(math.round_to_mintick(array.get(sr_levs, x))), color = lab_col,
textcolor = lab_col, style = lab_loc, size = size.small))
hlabel := enableSR and useZones ? label.new(bar_index + label_loc +
math.round(math.sign(label_loc)) * 20, highestph, "" + str.tostring(highestph),
color=hi_col, textcolor=colorfont, style=label.style_none) : na
llabel := enableSR and useZones ? label.new(bar_index + label_loc +
math.round(math.sign(label_loc)) * 20, lowestpl , "" + str.tostring(lowestpl) ,
color=lo_col, textcolor=colorfont, style=label.style_none ) : na

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy