DALE`!DMI & ADX indicators as defined by Wells Wilder. Coded by Rich Denning on 6/12/00
!Error in code fixed by Bill Shalasha on 8/25/01 (ZERO was added)
!Bill added ADXR 8/25/01
Dailyrange is [high]-[low].
Ycloseh is abs(val([close],1)-[low]).
Yclosel is abs(val([close],1)-[high]).
Trange1 is Max(Dailyrange,Ycloseh).
Trange is Max(Trange1,Yclosel).
define days 27.
!NOTE: Wilder says he is using a 14 day averaging method but if expontential averages are used
! 27 days must be used to closely approximate his 14 days weighted averaging method.
!+DM CODE:
yhigh is val([high],1).
ylow is val([low],1).
rhigh is ([high]-yhigh).
rlow is (ylow-[low]).
DMplus is iff(rhigh > 0 and rhigh > rlow, rhigh, 0).
DMminus is iff(rlow > 0 and rlow >= rhigh, rlow, 0).
AvgPlusDM is expAvg(DMplus,days).
AvgMinusDM is expavg(DMminus,days).
!AVERAGE TRUE RANGE FOR ADX14 USE 27 DAYS WITH EXPAVG:
ATR is expAvg(Trange,Days).
!DMI CODE:
PlusDMI is (AvgPlusDM/ATR)*100. !PLOT AS INDICATOR (2lines)
MinusDMI is AvgMinusDM/ATR*100. !PLOT AS INDICATOR (2 lines).
!ADX INDICATOR as defined by Wells Wilder
DIdiff is PlusDMI-MinusDMI. !PLOT DIdiff as historigram is same as DirMov (AIQ built in indicator)
ZERO if PlusDMI = 0 and MinusDMI =0.
DIsum is PlusDMI+MinusDMI.
DX is iff(ZERO,100,abs(DIdiff)/DIsum*100).
ADX is ExpAvg(DX,days). !PLOT ADX as single line indicator with support at 24 is same as ADX (AIQ)
!==================================================
! ADX Rate using the Least Means Squared method
!Coded by Bill Shalasha on 8/25/01
define periods 14.
n is HasDataFor(periods).
x is offsettodate(month(),day(),year()) + 1.
daysqr is x * x.
sumdaysqr is Sum(daysqr,n).
sumdays is Sum(x,n).
sumx is Sum( x * ADX ,n).
sumADX is Sum(ADX,n).
D is (sumdays*sumdays) - ( n * sumdaysqr).
ADXRate1 is ((n * sumx) - ( sumdays * sumADX)) / D.
!!=================================================
List if 1.
ADXRate2 is slope2(ADX,periods).
ADXaiq is [ADX].Rule Library CCodeViewListCReportViewSymbolPADXaiqXADXX ADX RateX ADXRate1X ADXRate2XABCRsBsB/\?0\? 0\?ABWGHBHBʖ?ʖ?ʖ?ABS**>j>ABGX(A(A<?<?<?ABCPAA8s3*s%)sAAIώAώA>>>AA@A9AN'?N'?N'?ACAIAAcccABX$A!A%d?%d?%d?AAPLؕAەA]>>+>ABFVAVAD>G>c>ACAPјAVA(|>w>x>ABIZYAYAL?L?L?ABPAAa-Va-_a-ABMDҿAֿAT=T>=T>=T>ACDOA
AhF?\F?bF?AաAաA搜>ͪ>몎>ACE]fAPfAP~P~PAAUKPAPA'=b'=(=ABFS\A.ALfMfTMfABIq~Al~ADD&ABYxAxAs=s=s=ACASWAWA||{ABKNANAYx>vYx>Yx>AAS5A5ABBBABT1A1Aӱ,,,AC@@ŊTRIALLISCBackTestPropertyHG3ExitLong2PPe+ HG3SPXP**