Pine Code To Plot the Fibonacci 61.8% Retracement level on the TradvingView.com chart

//@version=4
study("Fibonacci 61.8% Retracement Level", shorttitle="Fib 61.8%", overlay=true)

// Input for the length of the period to calculate the high and low
length = input(100, title="Length")

// Calculate the highest and lowest closing prices over the specified period
high = highest(close, length)
low = lowest(close, length)
diff = high - low

// Calculate the Fibonacci 61.8% retracement level
fib_61_8 = low + 0.618 * diff

// Plot the Fibonacci 61.8% retracement level on the chart
plot(fib_61_8, title="Fib 61.8% Level", color=color.yellow, linewidth=2)

// Display the high and low levels on the chart for reference
//plot(high, title="High", color=color.red, linewidth=1)
//plot(low, title="Low", color=color.green, linewidth=1)

// Highlight the area between the low and the Fibonacci 61.8% retracement level
//bgcolor(close < fib_61_8 and close > low ? color.new(color.blue, 90) : na, title="Fib 61.8% Area Highlight")