hola. Con ese código no lo conseguirás. primero antes de nada, encontrarás un error en la línea donde defines c3. no puedes poner sin más c3, tienes que definirla (c3=xx).
Segundo, para identificar un doble suelo tienes que almacenar los puntos para poder luego mirar atrás y ver si ahora mismo están ahí.
Mira, te pongo un ejemplo de indicador que podrías adaptar para screener. No haría falta usar arrays, se podrían almacenar simplemente los 2 ultimos minimos.
//----------------------------------------------------------//
// PRC_Double Top / Bottom
// version = 0
// 28.01.2025
// Iván González @ www.prorealcode.com
// Sharing ProRealTime knowledge
//----------------------------------------------------------//
// Inputs
//----------------------------------------------------------//
//x = 21 // Time horizon for the pivot detection (number of bars back)
src = close // Source price (close price in this case)
//onlysignals = 0 // Whether to display only the signals or include visualization
//----------------------------------------------------------//
// Limit for price difference
//----------------------------------------------------------//
limit1 = average[100](abs(open - close)) // Average of the absolute difference between open and close (over 100 periods)
//----------------------------------------------------------//
// Pivots high and low
//----------------------------------------------------------//
// Pivots low
if src > src[x] AND lowest[x](src) > src[x] AND src[x] < lowest[x](src)[x+1] THEN
$pivoty[n+1] = src[x]
$pivotx[n+1] = barindex[x]
$pivotdir[n+1] = -1
n = n + 1
ENDIF
// Pivots high
if src < src[x] AND highest[x](src) < src[x] AND src[x] > highest[x](src)[x+1] THEN
$pivoty[n+1] = src[x]
$pivotx[n+1] = barindex[x]
$pivotdir[n+1] = 1
n = n + 1
ENDIF
//----------------------------------------------------------//
// Checking for double top / bottom patterns
//----------------------------------------------------------//
if n > 3 THEN
// Checking for a double bottom pattern
if n <> n[1] AND $pivotdir[n] < 0 AND $pivotdir[n-1] > 0 AND $pivotdir[n-2] < 0 AND $pivotdir[n-3] > 0 AND abs(close[x] - $pivoty[n-2]) < limit1 THEN
drawarrowup($pivotx[n], $pivoty[n]) coloured("green") // Draw an upward arrow for double bottom signal
if onlysignals = 0 THEN
drawsegment($pivotx[n-1], $pivoty[n-1], $pivotx[n], $pivoty[n]) coloured("green")
drawsegment($pivotx[n-1], $pivoty[n-1], $pivotx[n-2], $pivoty[n-2]) coloured("green")
drawsegment($pivotx[n-3], $pivoty[n-3], $pivotx[n-2], $pivoty[n-2]) coloured("green")
ENDIF
awaitingDBC = 1 // Mark as awaiting double bottom confirmation
Bthresh = $pivoty[n-1] // Set the threshold price for confirmation
BthreshIdx = $pivotx[n-1] // Store the bar index of the threshold
ENDIF
// Checking for a double top pattern
if n <> n[1] AND $pivotdir[n] > 0 AND $pivotdir[n-1] < 0 AND $pivotdir[n-2] > 0 AND $pivotdir[n-3] < 0 AND abs(close[x] - $pivoty[n-2]) < limit1 THEN
drawarrowdown($pivotx[n], $pivoty[n]) coloured("red") // Draw a downward arrow for double top signal
if onlysignals = 0 THEN
drawsegment($pivotx[n-1], $pivoty[n-1], $pivotx[n], $pivoty[n]) coloured("red")
drawsegment($pivotx[n-1], $pivoty[n-1], $pivotx[n-2], $pivoty[n-2]) coloured("red")
drawsegment($pivotx[n-3], $pivoty[n-3], $pivotx[n-2], $pivoty[n-2]) coloured("red")
ENDIF
awaitingDTC = 1 // Mark as awaiting double top confirmation
Tthresh = $pivoty[n-1] // Set the threshold price for confirmation
TthreshIdx = $pivotx[n-1] // Store the bar index of the threshold
ENDIF
ENDIF
//----------------------------------------------------------//
// Confirmation of patterns
//----------------------------------------------------------//
if awaitingDBC AND onlysignals = 0 THEN
barsDBC = barsDBC + 1 // Increment the bar counter for double bottom confirmation
if close < Bthresh AND barsDBC > x THEN
awaitingDBC = 0
drawsegment(BthreshIdx, Bthresh, barindex, Bthresh) coloured("green") style(dottedline)
drawpoint(barindex, Bthresh, 3) coloured("orange")
ELSIF close > Bthresh THEN
awaitingDBC = 0
drawsegment(BthreshIdx, Bthresh, barindex, Bthresh) coloured("green") style(dottedline)
ENDIF
ENDIF
if awaitingDTC AND onlysignals = 0 THEN
barsDTC = barsDTC + 1 // Increment the bar counter for double top confirmation
if close > Tthresh AND barsDTC > x THEN
awaitingDTC = 0
drawsegment(TthreshIdx, Tthresh, barindex, Tthresh) coloured("red") style(dottedline)
drawpoint(barindex, Tthresh, 3) coloured("orange") // Mark the confirmation point
ELSIF close < Tthresh THEN
awaitingDTC = 0
drawsegment(TthreshIdx, Tthresh, barindex, Tthresh) coloured("red") style(dottedline)
ENDIF
ENDIF
//----------------------------------------------------------//
return