Wick Percentage Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © allmightycrypto
//@version=5
indicator("Wick Percentage Indicator", shorttitle="Wick %", overlay=false)

// Calculate the greater wick size
 
wick_upper = high - close
wick_lower = low - open
if (open - close > 0)
    // down candle
    wick_upper := high - open
    wick_lower := low - close
// greater_wick = math.max(wick_high, wick_low)

// Calculate the wick percentage as a percent of the opening price
// wick_percentage = (greater_wick / open) * 100
lower_wick_percentage = (wick_lower / open) * 100
upper_wick_percentage = (wick_upper / open) * 100

// Plot the wick percentage on the chart
// plot(wick_percentage, title="Upper Wick %", color=color.blue, linewidth=2)
plot(upper_wick_percentage, title="Upper Wick %", color=color.blue, linewidth=2)
plot(lower_wick_percentage, title="Lower Wick %", color=color.red, linewidth=2)
