// Definición de los parámetros del código
DEFPARAM CumulateOrders = True // Acumulación de posiciones desactivada
ONCE MaxPositions = 5
IF Not OnMarket THEN
Cuenta = 0
ENDIF
// Condiciones de entrada de posiciones cortas
indicator2, indicator1 = CALL "PRC_Top Bottom Indicator"[14, 14]
c1 = (indicator1 > indicator2)
indicator3 = CALL "butter prorealcode"
indicator4 = CALL "butter prorealcode"
c2 = (indicator3 < indicator4[1])
indicator5 = CALL "butter prorealcode"
indicator6 = ExponentialAverage[14](close)
c3 = (indicator5 < indicator6)
IF c1 AND c2 AND c3 AND Cuenta < MaxPositions THEN
SELLSHORT (MaxPositions - Cuenta) SHARES AT MARKET
Cuenta = Cuenta + 1
ENDIF
// Condiciones de salida de posiciones cortas
indicator7, indicator8 = CALL "PRC_Top Bottom Indicator"[14,14]
c4 = (indicator7 > indicator8)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
IF ShortOnMarket AND CountOfShortShares >= 99 THEN
EXITSHORT AT MARKET
ENDIF
//
//graph Cuenta
//graph abs(CountOfPosition)
//graph OnMarket
//graph c4