This is the Ehlers’ adaptive Stochastic code. The modified John Ehlers version of the Stochastic adapt the classical Stochastic period dynamically adapted to the market cycle. It tends to give more better indication as the standard Stochastic indicator itself.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
//c = 0.5 pri=Customclose CycPart=c If Barindex > 5 Then Smooth=(4*pri+3*pri[1]+2*pri[2]+pri[3])/10 Detrender=(0.0962*Smooth+0.5769*Smooth[2]-0.5769*Smooth[4]-0.0962*Smooth[6])*(0.075*Period[1]+0.54) REM Compute InPhase & Quadrature Components Q1=(0.0962*Detrender+0.5769*Detrender[2]-0.5769*Detrender[4]-0.0962*Detrender[6])*(0.075*Period[1]+0.54) I1=Detrender[3] REM Advance The Phase Of I1 & Q1 By 90 Degrees jI=(0.0962*I1+0.5769*I1[2]-0.5769*I1[4]-0.0962*I1[6])*(0.075*Period[1]+0.54) jQ=(0.0962*Q1+0.5769*Q1[2]-0.5769*Q1[4]-0.0962*Q1[6])*(0.075*Period[1]+0.54) REM Phasor Addition I2=I1-jQ Q2=Q1+jI REM Smooth The I & Q Components I2=0.2*I2+0.8*I2[1] Q2=0.2*Q2+0.8*Q2[1] REM Homodyne Discriminator Re=I2*I2[1]+Q2*Q2[1] Im=I2*Q2[1]-Q2*I2[1] Re=0.2*Re+0.8*Re[1] Im=0.2*Im+0.8*Im[1] If Im <> 0 And Re <> 0 Then Period=360/ATAN(Im/Re) Endif If Period > 1.5*Period[1] Then Period=1.5*Period[1] Endif If Period < 0.67*Period[1] Then Period=0.67*Period[1] Endif If Period < 6 Then Period=6 Endif If Period > 50 Then Period=50 Endif Period=0.2*Period+0.8*Period[1] SmoothPeriod=0.33*Period+0.67*SmoothPeriod[1] HH=High LL=Low For count=0 To Round(CycPart*SmoothPeriod)-1 If High[count] > HH Then HH=High[count] Endif If Low[count] < LL Then LL=Low[count] Endif Next If HH-LL <> 0 Then ASto=(Close-LL)/(HH-LL)*100 Endif Endif Return ASto as "Adaptive Stochastic", 50, 80, 20 |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
falta poner bandas por la parte de arriba: 80 y por la parte de abajo: 20