This expiremental version of the ADX trend indicator is using VHF filter (Vertical Horizontal filter) smoothed with ISSM function (Exponential Smoothing and Innovation State Space Model).
It has floating levels (and so median one too), which make it adaptive to market, relying on last higher highs and lower lows of the indicator. These levels seem to be sometimes a bit ‘out of sync’, but it is already the case in the original version.
Periods, smoothing, dynamic levels threshold can be modified in the settings.
This indicator was converted from a MT4 code version by a request in the Spanish forum.
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
//PRC_ADX VHF adaptive floatlvls | indicator //25.05.2018 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //converted from MT4 code version //period = 25 // ADXm period //Smooth = 15 // Smoothing period for price filter //minmaxPeriod = 25 // Period for floating zero //upLevel = 90 // Upper level //downLevel = 10 // Lower level if barindex>period+minmaxPeriod then noise = 0 vhf = 0 mmax = Close[0] mmin = Close[0] for k=0 to period-1 do noise = noise+Abs(Close[k]-Close[k+1]) mmax = Max(Close[k],mmax) mmin = Min(Close[k],mmin) next if (noise>0) then vhf = (mmax-mmin)/noise endif tperiod = period fzPeriod = minmaxPeriod if (vhf>0) then tperiod = -Log(vhf)*period fzPeriod = round(Max(-Log(vhf)*minmaxPeriod,3)) endif alpha = 2.0/(tperiod+1.0) //ISSM settings Pi = 3.14159265358979323846264338327950288 a1 = Exp(-1.414*Pi/Smooth) b1 = 2.0*a1*Cos(1.414*Pi/Smooth) sc2 = b1 sc3 = -a1*a1 sc1 = 1.0 - sc2 - sc3 //Exponential Smoothing and Innovation State Space Model (ISSM) tprice = High workSsm01 = tprice if barindex>1 then workSsm11 = sc1*(workSsm01+workSsm01[1])/2.0 + sc2*workSsm11[1] + sc3*workSsm11[2] else workSsm11 = tprice endif hc = workSsm11 //Exponential Smoothing and Innovation State Space Model (ISSM) tprice = Low workSsm02 = tprice if barindex>1 then workSsm12 = sc1*(workSsm02+workSsm02[1])/2.0 + sc2*workSsm12[1] + sc3*workSsm12[2] else workSsm12 = tprice endif lc = workSsm12 //Exponential Smoothing and Innovation State Space Model (ISSM) tprice = Close[1] workSsm03 = tprice if barindex>1 then workSsm13 = sc1*(workSsm03+workSsm03[1])/2.0 + sc2*workSsm13[1] + sc3*workSsm13[2] else workSsm13 = tprice endif cp = workSsm13 //Exponential Smoothing and Innovation State Space Model (ISSM) tprice = High[1] workSsm04 = tprice if barindex>1 then workSsm14 = sc1*(workSsm04+workSsm04[1])/2.0 + sc2*workSsm14[1] + sc3*workSsm14[2] else workSsm14 = tprice endif hp = workSsm14 //Exponential Smoothing and Innovation State Space Model (ISSM) tprice = Low[1] workSsm05 = tprice if barindex>1 then workSsm15 = sc1*(workSsm05+workSsm05[1])/2.0 + sc2*workSsm15[1] + sc3*workSsm15[2] else workSsm15 = tprice endif lp = workSsm15 dh = Max(hc-hp,0) dl = Max(lp-lc,0) if(dh=dl) then dh=0 dl=0 elsif(dh<dl) then dh=0 elsif(dl<dh) then dl=0 endif ttr = Max(hc,cp)-Min(lc,cp) dhk = 0 dlk = 0 if(ttr<>0) then dhk = 100.0*dh/ttr dlk = 100.0*dl/ttr endif workzdh = workzdh[1] + alpha*(dhk-workzdh[1]) workzdl = workzdl[1] + alpha*(dlk-workzdl[1]) dDI = workzdh - workzdl div = Abs(workzdh + workzdl) temp = 0 if( div <> 0.0) then temp = 100*dDI/div endif aADX = aADX[1]+alpha*(temp-aADX[1]) //floating levels //flLookBack = MinMaxPeriod // Floating levels lookback period flLevelUp = upLevel // Floating levels up level % flLevelDown = downLevel // Floating levels down level % maxi = highest[fzperiod](aadx) mini = lowest[fzperiod](aadx) rrange = maxi-mini flu = mini+flLevelUp*rrange/100.0 fld = mini+flLevelDown*rrange/100.0 flm = mini+0.5*rrange //colors r=244 g=164 b= 96 if aadx>flm then r=30 g=144 b=255 endif endif return aadx coloured(r,g,b)style(line,3), flu coloured(100,100,100) style(dottedline),fld coloured(100,100,100) style(dottedline),flm coloured(100,100,100) style(dottedline) |
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials