Untitled

mail@pastecode.io avatar
unknown
plain_text
17 days ago
1.2 kB
31
Indexable
Never
//@version=5
indicator("Trend Çizgi Yatay", overlay=true)

// Initial and final prices
initial_price = input(6, title="Yüzdelik değer ayarlama")
final_price = input(6000, title="Trend Çizgi ekleme")
increment = input(6, title="Initial arada ki makas bozmadan Trend çizgi ekleme")

// Color input
line_color = input.color(color.new(color.white, 50), title="Line Color")

// Line style input
line_style = input.string(defval="Solid", title="Line Style", options=["Solid", "Dotted", "Dashed"])
line_width = input.int(2, title="Line Width", minval=1)

// Convert line style to Pine Script style
line_style_pine = line.style_solid
if line_style == "Dotted"
    line_style_pine := line.style_dotted
else if line_style == "Dashed"
    line_style_pine := line.style_dashed

// Calculate levels
levels = array.new_float(0)
for price = initial_price to final_price by increment
    array.push(levels, price)

// Draw horizontal lines for the current bar only
for i = 0 to array.size(levels) - 1
    level = array.get(levels, i)
    line.new(x1=bar_index, y1=level, x2=bar_index + 1, y2=level, color=line_color, width=line_width, style=line_style_pine, extend=extend.both)
Leave a Comment