Below I show an example code where the if code is repeated and I would need to put it in a function that each if would call it.
if (Tendencia == true)
{
Print("Apertura: " + Opens[0][i]);
Print("Cierre: " + Closes[0][i]);
Print("Máximo: " + Highs[0][i]);
Print("Mínimo: " + Lows[0][i]);
{
double min = Lows[0][i];
if (min < minLow)
{
if (Tendencia == false)
{
Print("Datos de la vela " + i );
Print("Apertura: " + Opens[0][i]);
Print("Cierre: " + Closes[0][i]);
Print("Máximo: " + Highs[0][i]);
Print("Mínimo: " + Lows[0][i]);
double high = Highs[0][i]; // Obtener el máximo de la vela actual
if (high > maxHigh)
{
double min = Lows[0][i]; // Obtener el mínimo de la vela actual
if (min < minLow)
{
Comment