Untitled
unknown
plain_text
2 months ago
5.7 kB
7
Indexable
//@version=6
indicator('088Noir-Fibs', overlay = true)
// ────────────────────────────────────────────────
// User inputs
// ────────────────────────────────────────────────
userColor = input.color(color.white, title = 'Line Color')
userTextColor = input.color(color.black, title = 'Text Color')
userLabelOffset = input.int(75, title = 'Label Offset', minval = 10, maxval = 300)
lineStyleChoice = input.string('Dotted', title = 'Line Style', options = ['Solid', 'Dotted', 'Dashed'])
// Convert user choice to Pine Script line style
var lineStyle = line.style_solid
if lineStyleChoice == 'Dotted'
lineStyle := line.style_dotted
lineStyle
else if lineStyleChoice == 'Dashed'
lineStyle := line.style_dashed
lineStyle
// else → remains solid (default)
// ────────────────────────────────────────────────
// Function to draw one fib line + label
// ────────────────────────────────────────────────
f_plot_line_with_label(float y, string title, color col) =>
// Horizontal line across the chart
line.new(x1 = bar_index - 4999, y1 = y, x2 = bar_index + 500, y2 = y, color = col, width = 1, style = lineStyle)
// Price label on the right
label.new(x = bar_index + userLabelOffset, y = y, text = str.tostring(y, format.mintick), color = col, style = label.style_label_left, textcolor = userTextColor, size = size.small) // changed to left so price is more readable textcolor = userTextColor, size = size.small )
// ────────────────────────────────────────────────
// Very small levels (sub-0.01)
// ────────────────────────────────────────────────
f_plot_line_with_label(0.00001, '0.00001', userColor)
f_plot_line_with_label(0.00002, '0.00002', userColor)
f_plot_line_with_label(0.00003, '0.00003', userColor)
f_plot_line_with_label(0.00005, '0.00005', userColor)
f_plot_line_with_label(0.00008, '0.00008', userColor)
f_plot_line_with_label(0.0001, '0.0001', userColor)
f_plot_line_with_label(0.0002, '0.0002', userColor)
f_plot_line_with_label(0.0003, '0.0003', userColor)
f_plot_line_with_label(0.0005, '0.0005', userColor)
f_plot_line_with_label(0.0008, '0.0008', userColor)
// ────────────────────────────────────────────────
// Classic 0.0xx – 0.xx fibs
// ────────────────────────────────────────────────
f_plot_line_with_label(0.001, '0.001', userColor)
f_plot_line_with_label(0.002, '0.002', userColor)
f_plot_line_with_label(0.003, '0.003', userColor)
f_plot_line_with_label(0.005, '0.005', userColor)
f_plot_line_with_label(0.008, '0.008', userColor)
f_plot_line_with_label(0.010, '0.010', userColor)
f_plot_line_with_label(0.020, '0.020', userColor)
f_plot_line_with_label(0.030, '0.030', userColor)
f_plot_line_with_label(0.050, '0.050', userColor)
f_plot_line_with_label(0.080, '0.080', userColor)
f_plot_line_with_label(0.100, '0.100', userColor)
f_plot_line_with_label(0.130, '0.130', userColor)
f_plot_line_with_label(0.210, '0.210', userColor)
f_plot_line_with_label(0.340, '0.340', userColor)
f_plot_line_with_label(0.550, '0.550', userColor)
f_plot_line_with_label(0.890, '0.890', userColor)
// ────────────────────────────────────────────────
// Integers and higher fib extensions
// ────────────────────────────────────────────────
f_plot_line_with_label(1, '1', userColor)
f_plot_line_with_label(2, '2', userColor)
f_plot_line_with_label(3, '3', userColor)
f_plot_line_with_label(5, '5', userColor)
f_plot_line_with_label(8, '8', userColor)
f_plot_line_with_label(13, '13', userColor)
f_plot_line_with_label(21, '21', userColor)
f_plot_line_with_label(34, '34', userColor)
f_plot_line_with_label(55, '55', userColor)
f_plot_line_with_label(89, '89', userColor)
f_plot_line_with_label(144, '144', userColor)
f_plot_line_with_label(233, '233', userColor)
f_plot_line_with_label(377, '377', userColor)
f_plot_line_with_label(610, '610', userColor)
f_plot_line_with_label(987, '987', userColor)
f_plot_line_with_label(1597, '1597', userColor)
f_plot_line_with_label(2584, '2584', userColor)
f_plot_line_with_label(4181, '4181', userColor)
f_plot_line_with_label(6765, '6765', userColor) // fixed typo 6767→6765
f_plot_line_with_label(10946, '10946', userColor)
f_plot_line_with_label(17711, '17711', userColor)
f_plot_line_with_label(28657, '28657', userColor)
f_plot_line_with_label(46368, '46368', userColor)
f_plot_line_with_label(75025, '75025', userColor)
f_plot_line_with_label(121393, '121393', userColor)
f_plot_line_with_label(196418, '196418', userColor)
f_plot_line_with_label(317811, '317811', userColor)
f_plot_line_with_label(514229, '514229', userColor)
// (you can continue adding higher levels if needed)
// Dummy plot to satisfy compiler (not really needed in v5 anymore but harmless)
plot(na, display = display.none)
Editor is loading...
Leave a Comment