Last active
June 4, 2026 02:05
-
-
Save rajvermacas/4716ec0b5efe4e8f8fadc6e2fca625e9 to your computer and use it in GitHub Desktop.
Trading view indicator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //@version=5 | |
| indicator("Fixed Horizontal Support Levels", shorttitle="Fixed Supports", overlay=true) | |
| // ==================== INPUT SETTINGS ==================== | |
| len_left = input.int(100, "Line Length Left", minval=10, maxval=500, group="Line Settings") | |
| len_right = input.int(100, "Line Length Right", minval=10, maxval=500, group="Line Settings") | |
| // -3% Level | |
| color3 = input.color(color.new(color.red, 0), " -3% Line Color", group=" -3% Level") | |
| thick3 = input.int(2, " -3% Line Thickness", minval=1, maxval=5, group=" -3% Level") | |
| // -4.5% Level | |
| color49 = input.color(color.new(color.orange, 0), " -4.5% Line Color", group=" -4.5% Level") | |
| thick49 = input.int(2, " -4.5% Line Thickness", minval=1, maxval=5, group=" -4.5% Level") | |
| // +14% Level | |
| color14 = input.color(color.new(color.green, 0), " +14% Line Color", group=" +14% Level") | |
| thick14 = input.int(2, " +14% Line Thickness", minval=1, maxval=5, group=" +14% Level") | |
| // +15% Level | |
| color15 = input.color(color.new(color.lime, 0), " +15% Line Color", group=" +15% Level") | |
| thick15 = input.int(2, " +15% Line Thickness", minval=1, maxval=5, group=" +15% Level") | |
| // Vertical Line Settings | |
| vlineColor = input.color(color.new(color.gray, 40), "9:15 Vertical Line Color", group="Vertical Line") | |
| vlineWidth = input.int(1, "9:15 Vertical Line Width", minval=1, maxval=5, group="Vertical Line") | |
| // ==================== CALCULATIONS ==================== | |
| price = close | |
| support3 = price * 0.97 | |
| support49 = price * 0.955 | |
| target14 = price * 1.14 | |
| target15 = price * 1.15 | |
| // Calculate ATR globally | |
| atrValue = ta.atr(14) | |
| // ==================== SHADED ZONES ==================== | |
| entryPlot = plot(price, title="Entry", display=display.none) | |
| slPlot = plot(support3, title="-3%", display=display.none) | |
| tpPlot = plot(target14, title="+14%", display=display.none) | |
| fill(entryPlot, slPlot, color=color.new(color.red, 85), title="Stop Loss Zone") | |
| fill(entryPlot, tpPlot, color=color.new(color.green, 85), title="Profit Zone") | |
| // ==================== DRAW HORIZONTAL LINES ==================== | |
| var line line3 = na | |
| var line line49 = na | |
| var line line14 = na | |
| var line line15 = na | |
| if barstate.islast | |
| line.delete(line3) | |
| line.delete(line49) | |
| line.delete(line14) | |
| line.delete(line15) | |
| line3 := line.new( | |
| x1=bar_index-len_left, | |
| y1=support3, | |
| x2=bar_index+len_right, | |
| y2=support3, | |
| color=color3, | |
| width=thick3, | |
| extend=extend.both) | |
| line49 := line.new( | |
| x1=bar_index-len_left, | |
| y1=support49, | |
| x2=bar_index+len_right, | |
| y2=support49, | |
| color=color49, | |
| width=thick49, | |
| extend=extend.both) | |
| line14 := line.new( | |
| x1=bar_index-len_left, | |
| y1=target14, | |
| x2=bar_index+len_right, | |
| y2=target14, | |
| color=color14, | |
| width=thick14, | |
| extend=extend.both) | |
| line15 := line.new( | |
| x1=bar_index-len_left, | |
| y1=target15, | |
| x2=bar_index+len_right, | |
| y2=target15, | |
| color=color15, | |
| width=thick15, | |
| extend=extend.both) | |
| // ==================== DRAW 9:15 VERTICAL LINE ==================== | |
| isIntraday = timeframe.isintraday | |
| is915 = (hour == 9 and minute == 15) | |
| if isIntraday and is915 | |
| line.new( | |
| x1=bar_index, | |
| y1=low-(atrValue*2), | |
| x2=bar_index, | |
| y2=high+(atrValue*2), | |
| color=vlineColor, | |
| width=vlineWidth, | |
| style=line.style_dashed, | |
| extend=extend.both) | |
| // ==================== LABELS ==================== | |
| if barstate.islast | |
| label.new( | |
| bar_index + 8, | |
| support3, | |
| text="-3% : " + str.tostring(support3, "#.##"), | |
| color=color3, | |
| textcolor=color.white, | |
| style=label.style_label_left) | |
| label.new( | |
| bar_index + 8, | |
| support49, | |
| text="-4.5% : " + str.tostring(support49, "#.##"), | |
| color=color49, | |
| textcolor=color.white, | |
| style=label.style_label_left) | |
| label.new( | |
| bar_index + 8, | |
| target14, | |
| text="+14% : " + str.tostring(target14, "#.##"), | |
| color=color14, | |
| textcolor=color.white, | |
| style=label.style_label_left) | |
| label.new( | |
| bar_index + 8, | |
| target15, | |
| text="+15% : " + str.tostring(target15, "#.##"), | |
| color=color15, | |
| textcolor=color.white, | |
| style=label.style_label_left) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment