Zero Lag ZigZag Stochastic

Category: Indicators By: Matriciel Created: October 25, 2018, 4:59 PM
October 25, 2018, 4:59 PM
Indicators
4 Comments

Hi all,
Here is an home made indicator.
I took the indicator code stochastic and I integrated the ZigZag.
I thank Jose7674 very much for his code, concerning the divergences of the MACD, which I used for my indicator.
See: MACD Divergences on price and indicator

//Zero Lag ZigZag Stochastic
//Le 23 octobre 2018
//Matriciel @ www.prorealcode.com
//Sharing ProRealTime knowledge

//Settings
Q = 5
R = 5
Lookback = 120
Periode = 20
PeriodeZZ = 0.02

//Zero Lag ZigZag Stochastic
ZZH = ZigZag[PeriodeZZ](HIGH)
ZZL = ZigZag[PeriodeZZ](LOW)

plusHaut = HIGHEST[Periode](ZZH)
plusBas = LOWEST[Periode](ZZL)
 
A = (CLOSE - plusBas) / (plusHaut - plusBas) * 100
 
B = AVERAGE[Q](A)
ligneK = AVERAGE[Q](B)
Difference = (A - ligneK)
C = (B + Difference)
ZeroLagSto = AVERAGE[5](C)
ligneD = AVERAGE[R](ZeroLagSto)

///divergence baissière
IF (ZeroLagSto[1]>ZeroLagSto AND ZeroLagSto[1]>ZeroLagSto[2]) THEN
 extremum2=ZeroLagSto[1]
 extremum1=highest[Lookback](ZeroLagSto)
 preciomax2=close[1]
 preciomax=Highest[Lookback](close)
 IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN
  for i=1 to Lookback
   if ZeroLagSto[i]=extremum1 then
    zz=i
    drawsegment (barindex[1], ZeroLagSto[1], barindex[zz], ZeroLagSto[zz]) coloured(200,0,0)
   ENDIF
  next
 ENDIF
ENDIF
 
///divergence haussière
IF (ZeroLagSto[1]<ZeroLagSto AND ZeroLagSto[1]<ZeroLagSto[2]) THEN
 extremum22=ZeroLagSto[1]
 extremum11=lowest[Lookback](ZeroLagSto)
 preciomin2=close[1]
 preciomin=lowest[Lookback](close)
 IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN
  for i2=1 to Lookback
   if ZeroLagSto[i2]=extremum11[1] then
    zz2=i2
    drawsegment(barindex[1], ZeroLagSto[1], barindex[zz2], ZeroLagSto[zz2]) coloured(0,200,0)
   ENDIF
  next
 ENDIF
ENDIF
 
RETURN ZeroLagSto coloured(0,0,200) style(line,1) AS "ZeroLagSto", ligneD coloured(0,0,200) style(dottedline,1) AS "ligneD", 50 style(dottedline,1) AS "Middle"

 

Download
Filename: ZeroLag-ZigZag-Stochastic.itf
Downloads: 226
Matriciel Master
This author is like an anonymous function, present but not directly identifiable. More details on this code architect as soon as they exit 'incognito' mode.
Author’s Profile

Comments

Logo Logo
Loading...