Wicks percentages
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © angelreyesm

//@version=5
indicator("Wicks percentages", overlay = true)
// Definimos las variables necesarias para calcular el porcentaje de la mecha superior y la mecha inferior
upperWick = high - math.max(open, close)
lowerWick = math.min(open, close) - low

// Calculamos el porcentaje de la mecha superior y la mecha inferior
upperWickPercentage = (upperWick / (high - low)) * 100
lowerWickPercentage = (lowerWick / (high - low)) * 100

// Redondiamos los valores hacia abajo
upperWickPercentage1 = math.floor(upperWickPercentage)
lowerWickPercentage1 = math.floor(lowerWickPercentage)

// Mostramos los valores en la ventana de información de cada vela
label.new(bar_index, high,str.tostring(upperWickPercentage1), color = color.white)
label.new(bar_index, low, str.tostring(lowerWickPercentage1), yloc = yloc.belowbar, color = color.white)