Hola, intento crear un proscreener y no se que hago mal ya que al ejecutarlo no me devuelve el valor 1 nunca. Siempre me devuelve 2. Sin embargo, el indicador funciona correctamente y devuelve el 1 o el 2 cuando corresponde. Estoy desesperado ya que no consigo ejecutar un proscreener haciendo un CALL a un indicador. Gracias:
EMM660 = ExponentialAverage[660](close)
SMM20 = Average[15] (close)
if high > pmax[1] then
Pmax = high
barmax = barindex
endif
if SMM20 crosses over EMM660 or SMM20 crosses under EMM660 then
pmax = 0
barmax = 0
presenal = 0
pmaxprev = 0
endif
indica = 0
if EMM660[1] < EMM660 then // Es tendencia alcista
if high[3] > SMM20 and high[2] > SMM20 and close < SMM20 and close[1] crosses under SMM20 then
indica = 1
presenal = 1
pmaxprev = pmax
endif
else
pmax = 0
barmax = 0
presenal = 0
pmaxprev = 0
endif
if close > pmaxprev then
presenal = 2
endif
return presenal
Siempre use el botón “Insert PRT Code” cuando incluya e inserte un código en sus mensajes para que sea más fácil de leer para otros.
Puedes probar esto, pero no estoy seguro de si funciona, en el indicador que publicaste hay algunas variables sin usar y no sé para qué sirven:
EMM660 = ExponentialAverage[660](close)
SMM20 = Average[15] (close)
if high > pmax[1] then
Pmax = high
endif
if SMM20 crosses over EMM660 or SMM20 crosses under EMM660 then
pmax = 0
presenal = 0
pmaxprev = 0
endif
if EMM660[1] < EMM660 then // Es tendencia alcista
if high[3] > SMM20 and high[2] > SMM20 and close < SMM20 and close[1] crosses under SMM20 then
presenal = 1
pmaxprev = pmax
endif
else
pmax = 0
presenal = 0
pmaxprev = 0
endif
if close > pmaxprev then
presenal = 2
endif
SCREENER[presenal](presenal AS "1/2")