Hola a todos,
Necesitaría ayuda para programar un screener por velas de rechazo, continuando la tendencia.
Las características serían:
- Vela martillo por encima de la medía ponderada de 200 días (MMP200), la vela martillo tiene que marcar un mínimo de los últimos 7 días
- Vela estrella fugaz por debajo de la medía ponderada de 200 días (MMP200), la vela estrella fugaz tiene que marcar un máximo de los últimos 7 días
Como siempre adjunto ejemplo para que se entienda mejor.
Muchas gracias por vuestra ayuda
Ahi esta. Puede que no funcione bien con IG, ya que no es compatible con la versión PREMIUM de la plataforma y tiene un historial de solo 255 barras, mientras que WMA necesita mucho más que los 200 nominales y probablemente no sea suficiente.
Pruébelo, si no funciona, puede probar un WMA de 50-100 períodos. Si, por el contrario, desea exactamente 200 períodos, debe usar el PROMEDIO MÓVIL SIMPLE (SMA), así que reemplace 200,2 con 200,0 en la primera fila:
Wma200 = average[200,2] //Replace 200,2 with 200,0 to use a Simple Moving Average
Cond = 0
//--------------------------------------------------------------------------------------------------------------------
Body = abs(close - open)
UpperShadow = high - max(open,close)
LowerShadow = min(open,close) - low
//--------------------------------------------------------------------------------------------------------------------
// Hammer
//
Ha1 = LowerShadow >= (Body * 3) //Lower Shadow 3 times longer than the body
Ha2 = close >= (high-(range * 0.25))//must close in the upper 25% of its range
Ha3 = low = lowest[20](low) //its Low must be the lowest one of the last 20 candles (1=disabled)
Hammer = Ha1 AND Ha2 AND Ha3
//--------------------------------------------------------------------------------------------------------------------
// Shooting Star
//
Ss1 = UpperShadow >= (Body * 3) //Upper Shadow 3 times longer than the body
Ss2 = LowerShadow <= Body //Lower Shadow must be max as large as the body
Ss3 = close <= (low+(range * 0.25)) //must close in the lower 25% of its range
Ss4 = high = highest[20](high) //its High must be the highest one of the last 20 candles (1=disabled)
ShootingStar = Ss1 AND Ss2 AND Ss3 AND Ss4
//--------------------------------------------------------------------------------------------------------------------
IF Hammer THEN
IF (low = lowest[7](low)) AND (close > Wma200) THEN
Cond = 1
ENDIF
ELSIF ShootingStar THEN
IF high = highest[7](high) AND (close < Wma200) THEN
Cond = 2
ENDIF
ENDIF
//
SCREENER[Cond](Cond AS "1=Ham,2=Shoot")
Hola Roberto,
Gracias, pero no me devuelve los resultados esperados. He modificado el código como me dices pero tampoco funciona.
Igualmente muchas gracias por la ayuda.