Smoothed Heikin Ashi with Stochastic Signals

Category: Indicators By: rafadonl2 Created: February 19, 2017, 10:35 AM
February 19, 2017, 10:35 AM
Indicators
14 Comments

Second version of my previous heikin-ashi with stochastic including drawing a vertical orange line on every 3rd Friday of the month, which signals the end of options/warrants, due to the impact it has on closing values.


Rules in Heikin-Ashi:

1- White body sequence = upward trend.
  Sequence of black bodies = downtrend.
2- Strong bullish trend = Large white bodies and no lower shadows.
Strong bearish trend = Large black bodies without upper shadows.
3- When the tendency weakens small bodies appear with possible upper and / or lower shadows.
4- A consolidation occurs when small bodies appear with both shadows both above and below.
5- The reversal of a trend can be suspected with the appearance of small bodies with both upper and lower long shadows, or a sudden change of color

//Reglas en Heikin-Ashi:
//1- Secuencia de cuerpos blancos = tendencia alcista.
//   Secuencia de cuerpos negros = tendencia bajista.
//2- Tendencia alcista fuerte = Grandes cuerpos blancos y sin sombras inferiores.
//   Tendencia bajista fuerte = Grandes cuerpos negros sin sombras superiores.
//3- Cuando la tendencia se debilita surgen cuerpos pequeños con posibles sombras superior y/o inferior.
//4- Una consolidación se da cuando aparecen cuerpos pequeños con ambas sombras tanto arriba como abajo.
//5- La reversión de una tendencia se puede sospechar con la aparición de pequeños cuerpos con sombras largas tanto superiores como inferiores, o un cambio repentino de color.
//    parámetros
//ONCE SmoothPeriod=2      valor por defecto
//ONCE period=5            valor por defecto
//ONCE Kperiod=5           valor por defecto
//ONCE Kspeed=2            valor por defecto
//ONCE Dperiod=5           valor por defecto
ONCE flecha=0
ONCE Dflech=barindex
//    ciclo normal
IF BarIndex=0 THEN
xClose = (open+high+low+close)/4
xOpen = open
xHigh = high
xLow = low
ELSE
xClose = (open+high+low+close)/4
xOpen = (xOpen[1]+xClose[1])/2
xHigh = Max(max(high, xOpen), xClose)
xLow = Min(min(Low, xOpen), xClose)
ENDIF
//  SUAVIZADO con la media de 2 en las velas
IF barindex>=(period+SmoothPeriod) THEN
AvOpen=exponentialAverage[SmoothPeriod](xOpen)
AvHigh=exponentialAverage[SmoothPeriod](xHigh)
AvLow=exponentialAverage[SmoothPeriod](xLow)
AvClose=exponentialAverage[SmoothPeriod](xClose)
ENDIF
//    y ésta es la que uso
DRAWCANDLE(AvOpen, AvHigh, AvLow, AvClose)
//ha7  para indicar cruces
//   los valores para barindex<2 son especiales
IF Barindex < SmoothPeriod then
Opcl=Open[1]
ELSE
Opcl=Open
ENDIF
//    calculo dos medias de 7 y de 10
Media7 = Average[7](Opcl)
rango= Media7/10
//   uso rango para el dibujo
Alcista = AvOpen<AvClose
Alcista1 = AvOpen[1]<AvClose[1]
Bajista = AvOpen>AvClose
Bajista1 = AvOpen[1]>AvClose[1]
//
//ahora calculo el Estocástico
LineaK=100*((close-lowest[Kperiod](low))/(highest[Kperiod](high)-lowest[Kperiod](low)))
K=exponentialaverage[Kspeed](LineaK)
D=exponentialaverage[Dperiod](K)
//valor representa mi compra cuando estoy dentro
//  y el precio de venta cuando me salgo
//no puede haber dos operaciones en dos dias
//
IF Dflech < barindex[2] then
//IF (Opcl>Media7 or CruceOVayer or CruceOVhoy) and not (Bajista and Bajista1) and flecha<1 and K>D THEN
IF flecha<1 THEN
IF K>D THEN
IF (Opcl>Media7 or Bajista1) THEN
IF Alcista THEN
DRAWARROWUP (barindex, AvHigh+rango/4) COLOURED (0, 0, 255)
flecha=1
Dflech = barindex
valor = AvClose
//IF (Opcl<Media7 or CruceUNayer or CruceUNhoy) and not (Alcista and Alcista1) and flecha>=1 and K>D THEN
ENDIF
ENDIF
ENDIF
ELSIF flecha>=1 THEN
IF K<D THEN
IF (Opcl<Media7 or Alcista1) THEN
IF Bajista THEN
DRAWARROWDOWN (barindex, AvHigh+rango/4) COLOURED (255, 0, 0)
flecha=-1
Dflech = barindex
valor = AvClose
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
//  dibuja líneas en el tercer viernes de cada mes
If Dayofweek =5 and day>= 15 and Day<=21 then
DRAWVLINE(barindex) coloured(237,96,9)
endif
RETURN Media7 COLOURED (0,0,255) AS "M7",  K/100 AS "K", D/100 as "D", Bajista as "Baj", Alcista as "Alc",valor COLOURED (255,0,0) as "valor", Opcl-rango*0.5 COLOURED(0,0,0) as "Opcl-Rgo", Media7-rango*0.5 coloured (0,0,255) as "M7-Rgo"

Download
Filename: Smooth-HeikinAshi-Sto-Signals.itf
Downloads: 829
rafadonl2 Junior
Code artist, my biography is a blank page waiting to be scripted. Imagine a bio so awesome it hasn't been coded yet.
Author’s Profile

Comments

Logo Logo
Loading...