Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

PCF for Wilder's DX, and/or a CI for Wilder's ADX Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Tanstaafl
Posted : Saturday, December 11, 2004 1:39:55 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
(part two - prior posting deals with the DM's and DI's)

OK, here is the rest of the story ... regarding a PCF for the
Wilder's ADX, "true to form". I guess the "news" category for this
part is "Good news, until I read it" :~)

In my prior posting, I shared a DMI-crossover PCF with 10% error, which
was pretty long. It had four sections in it, each of which had a
formula with 32 rows with one day's DM calc per row.

The DX (not ADX) formula, per Wilder's math is:
DX = Abs( posDI14 - negDI14 ) / ( posDI14 + negDI14 )

Each of those DI terms can be changed to DM's without sacrificing
accuracy, by cancelling out all the True Range divisors (see prior
post). This saves a LOT of unnecessary PCF characters.

So the equation becomes:
DX = Abs( posDM14 - negDM14 ) / ( posDM14 + negDM14 )
where DM14 is a 14-day Wilder-Smoothed DM series

Each of the four terms has a similar length to each of the four
sections in the DMI-cross PCF that I posted earlier ... so the 10%
error DX PCF is itself essentially the same size as the DMI-cross
formula.

Wilder calls for the DX formula ITSELF to be Wilder-Smoothed ... for
10% accuracy that means the 14day ADX would be THIRTY TWO TIMES as
long as the PCF posted earlier.

Sorry ... that's just too big ... even for my taste :~)

HOWEVER, if you are willing to wait a while on the spacebar, you can
plot the DX formula as a Custom indicator in TC, and use TC's native
Smoothing input to apply that final step.

You can use Exponential smoothing as an accurate substitute for
Wilder's smoothing, if you convert the input periods appropriately.
XMApds4Wilder = (2 * WilderPds) -1
So, Wilder's 14-day smoothing is equivalent to a 27-day Exponential
Moving Average. This is a precise equivalency, btw.

IMHO, this equation has little practical value to the TC community,
since it take so long to calc once the smoothing is applied.
However there have been so many calls for an "ADX PCF", I thought
the best way to put the issue to rest would be to give it to you ...
so you can see for yourselves why you DON'T want it! :~)

I've *pleaded* with Worden to create a PCF functions for the ADX and
DI values (as well as for the MACD, LinReg and other plottable
stuff). I've been given no clue as to whether they are going to do
that or not ... so don't hold your breath! (but a prayer might help)


Wilder's DX (14-day Wilder Smoothing with 10% error)
Apply as a CI then use 27-day Exponential smoothing to get ADX

100 * Abs(
78.78*(H1-H0)*(H1-H0<L0-L1 and H0>H1)
+73.16*(H2-H1)*(H2-H1<L1-L2 and H1>H2)
+67.93*(H3-H2)*(H3-H2<L2-L3 and H2>H3)
+63.08*(H4-H3)*(H4-H3<L3-L4 and H3>H4)
+58.57*(H5-H4)*(H5-H4<L4-L5 and H4>H5)
+54.39*(H6-H5)*(H6-H5<L5-L6 and H5>H6)
+50.5*(H7-H6)*(H7-H6<L6-L7 and H6>H7)
+46.9*(H8-H7)*(H8-H7<L7-L8 and H7>H8)
+43.55*(H9-H8)*(H9-H8<L8-L9 and H8>H9)
+40.44*(H10-H9)*(H10-H9<L9-L10 and H9>H10)
+37.55*(H11-H10)*(H11-H10<L10-L11 and H10>H11)
+34.87*(H12-H11)*(H12-H11<L11-L12 and H11>H12)
+32.38*(H13-H12)*(H13-H12<L12-L13 and H12>H13)
+30.06*(H14-H13)*(H14-H13<L13-L14 and H13>H14)
+27.92*(H15-H14)*(H15-H14<L14-L15 and H14>H15)
+25.92*(H16-H15)*(H16-H15<L15-L16 and H15>H16)
+24.07*(H17-H16)*(H17-H16<L16-L17 and H16>H17)
+22.35*(H18-H17)*(H18-H17<L17-L18 and H17>H18)
+20.75*(H19-H18)*(H19-H18<L18-L19 and H18>H19)
+19.27*(H20-H19)*(H20-H19<L19-L20 and H19>H20)
+17.9*(H21-H20)*(H21-H20<L20-L21 and H20>H21)
+16.62*(H22-H21)*(H22-H21<L21-L22 and H21>H22)
+15.43*(H23-H22)*(H23-H22<L22-L23 and H22>H23)
+14.33*(H24-H23)*(H24-H23<L23-L24 and H23>H24)
+13.3*(H25-H24)*(H25-H24<L24-L25 and H24>H25)
+12.35*(H26-H25)*(H26-H25<L25-L26 and H25>H26)
+11.47*(H27-H26)*(H27-H26<L26-L27 and H26>H27)
+10.65*(H28-H27)*(H28-H27<L27-L28 and H27>H28)
+9.89*(H29-H28)*(H29-H28<L28-L29 and H28>H29)
+9.18*(H30-H29)*(H30-H29<L29-L30 and H29>H30)
+8.53*(H31-H30)*(H31-H30<L30-L31 and H30>H31)
+7.92*(H32-H31)*(H32-H31<L31-L32 and H31>H32)
- (
78.78*(L0-L1)*(H1-H0>L0-L1 and L0<L1)
+73.16*(L1-L2)*(H2-H1>L1-L2 and L1<L2)
+67.93*(L2-L3)*(H3-H2>L2-L3 and L2<L3)
+63.08*(L3-L4)*(H4-H3>L3-L4 and L3<L4)
+58.57*(L4-L5)*(H5-H4>L4-L5 and L4<L5)
+54.39*(L5-L6)*(H6-H5>L5-L6 and L5<L6)
+50.5*(L6-L7)*(H7-H6>L6-L7 and L6<L7)
+46.9*(L7-L8)*(H8-H7>L7-L8 and L7<L8)
+43.55*(L8-L9)*(H9-H8>L8-L9 and L8<L9)
+40.44*(L9-L10)*(H10-H9>L9-L10 and L9<L10)
+37.55*(L10-L11)*(H11-H10>L10-L11 and L10<L11)
+34.87*(L11-L12)*(H12-H11>L11-L12 and L11<L12)
+32.38*(L12-L13)*(H13-H12>L12-L13 and L12<L13)
+30.06*(L13-L14)*(H14-H13>L13-L14 and L13<L14)
+27.92*(L14-L15)*(H15-H14>L14-L15 and L14<L15)
+25.92*(L15-L16)*(H16-H15>L15-L16 and L15<L16)
+24.07*(L16-L17)*(H17-H16>L16-L17 and L16<L17)
+22.35*(L17-L18)*(H18-H17>L17-L18 and L17<L18)
+20.75*(L18-L19)*(H19-H18>L18-L19 and L18<L19)
+19.27*(L19-L20)*(H20-H19>L19-L20 and L19<L20)
+17.9*(L20-L21)*(H21-H20>L20-L21 and L20<L21)
+16.62*(L21-L22)*(H22-H21>L21-L22 and L21<L22)
+15.43*(L22-L23)*(H23-H22>L22-L23 and L22<L23)
+14.33*(L23-L24)*(H24-H23>L23-L24 and L23<L24)
+13.3*(L24-L25)*(H25-H24>L24-L25 and L24<L25)
+12.35*(L25-L26)*(H26-H25>L25-L26 and L25<L26)
+11.47*(L26-L27)*(H27-H26>L26-L27 and L26<L27)
+10.65*(L27-L28)*(H28-H27>L27-L28 and L27<L28)
+9.89*(L28-L29)*(H29-H28>L28-L29 and L28<L29)
+9.18*(L29-L30)*(H30-H29>L29-L30 and L29<L30)
+8.53*(L30-L31)*(H31-H30>L30-L31 and L30<L31)
+7.92*(L31-L32)*(H32-H31>L31-L32 and L31<L32)
) ) / (
78.78*(H1-H0)*(H1-H0<L0-L1 and H0>H1)
+73.16*(H2-H1)*(H2-H1<L1-L2 and H1>H2)
+67.93*(H3-H2)*(H3-H2<L2-L3 and H2>H3)
+63.08*(H4-H3)*(H4-H3<L3-L4 and H3>H4)
+58.57*(H5-H4)*(H5-H4<L4-L5 and H4>H5)
+54.39*(H6-H5)*(H6-H5<L5-L6 and H5>H6)
+50.5*(H7-H6)*(H7-H6<L6-L7 and H6>H7)
+46.9*(H8-H7)*(H8-H7<L7-L8 and H7>H8)
+43.55*(H9-H8)*(H9-H8<L8-L9 and H8>H9)
+40.44*(H10-H9)*(H10-H9<L9-L10 and H9>H10)
+37.55*(H11-H10)*(H11-H10<L10-L11 and H10>H11)
+34.87*(H12-H11)*(H12-H11<L11-L12 and H11>H12)
+32.38*(H13-H12)*(H13-H12<L12-L13 and H12>H13)
+30.06*(H14-H13)*(H14-H13<L13-L14 and H13>H14)
+27.92*(H15-H14)*(H15-H14<L14-L15 and H14>H15)
+25.92*(H16-H15)*(H16-H15<L15-L16 and H15>H16)
+24.07*(H17-H16)*(H17-H16<L16-L17 and H16>H17)
+22.35*(H18-H17)*(H18-H17<L17-L18 and H17>H18)
+20.75*(H19-H18)*(H19-H18<L18-L19 and H18>H19)
+19.27*(H20-H19)*(H20-H19<L19-L20 and H19>H20)
+17.9*(H21-H20)*(H21-H20<L20-L21 and H20>H21)
+16.62*(H22-H21)*(H22-H21<L21-L22 and H21>H22)
+15.43*(H23-H22)*(H23-H22<L22-L23 and H22>H23)
+14.33*(H24-H23)*(H24-H23<L23-L24 and H23>H24)
+13.3*(H25-H24)*(H25-H24<L24-L25 and H24>H25)
+12.35*(H26-H25)*(H26-H25<L25-L26 and H25>H26)
+11.47*(H27-H26)*(H27-H26<L26-L27 and H26>H27)
+10.65*(H28-H27)*(H28-H27<L27-L28 and H27>H28)
+9.89*(H29-H28)*(H29-H28<L28-L29 and H28>H29)
+9.18*(H30-H29)*(H30-H29<L29-L30 and H29>H30)
+8.53*(H31-H30)*(H31-H30<L30-L31 and H30>H31)
+7.92*(H32-H31)*(H32-H31<L31-L32 and H31>H32)
+
78.78*(L0-L1)*(H1-H0>L0-L1 and L0<L1)
+73.16*(L1-L2)*(H2-H1>L1-L2 and L1<L2)
+67.93*(L2-L3)*(H3-H2>L2-L3 and L2<L3)
+63.08*(L3-L4)*(H4-H3>L3-L4 and L3<L4)
+58.57*(L4-L5)*(H5-H4>L4-L5 and L4<L5)
+54.39*(L5-L6)*(H6-H5>L5-L6 and L5<L6)
+50.5*(L6-L7)*(H7-H6>L6-L7 and L6<L7)
+46.9*(L7-L8)*(H8-H7>L7-L8 and L7<L8)
+43.55*(L8-L9)*(H9-H8>L8-L9 and L8<L9)
+40.44*(L9-L10)*(H10-H9>L9-L10 and L9<L10)
+37.55*(L10-L11)*(H11-H10>L10-L11 and L10<L11)
+34.87*(L11-L12)*(H12-H11>L11-L12 and L11<L12)
+32.38*(L12-L13)*(H13-H12>L12-L13 and L12<L13)
+30.06*(L13-L14)*(H14-H13>L13-L14 and L13<L14)
+27.92*(L14-L15)*(H15-H14>L14-L15 and L14<L15)
+25.92*(L15-L16)*(H16-H15>L15-L16 and L15<L16)
+24.07*(L16-L17)*(H17-H16>L16-L17 and L16<L17)
+22.35*(L17-L18)*(H18-H17>L17-L18 and L17<L18)
+20.75*(L18-L19)*(H19-H18>L18-L19 and L18<L19)
+19.27*(L19-L20)*(H20-H19>L19-L20 and L19<L20)
+17.9*(L20-L21)*(H21-H20>L20-L21 and L20<L21)
+16.62*(L21-L22)*(H22-H21>L21-L22 and L21<L22)
+15.43*(L22-L23)*(H23-H22>L22-L23 and L22<L23)
+14.33*(L23-L24)*(H24-H23>L23-L24 and L23<L24)
+13.3*(L24-L25)*(H25-H24>L24-L25 and L24<L25)
+12.35*(L25-L26)*(H26-H25>L25-L26 and L25<L26)
+11.47*(L26-L27)*(H27-H26>L26-L27 and L26<L27)
+10.65*(L27-L28)*(H28-H27>L27-L28 and L27<L28)
+9.89*(L28-L29)*(H29-H28>L28-L29 and L28<L29)
+9.18*(L29-L30)*(H30-H29>L29-L30 and L29<L30)
+8.53*(L30-L31)*(H31-H30>L30-L31 and L30<L31)
+7.92*(L31-L32)*(H32-H31>L31-L32 and L31<L32)
)


Tanstaafl
Posted : Monday, December 13, 2004 6:37:01 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
As mentioned elsewhere, the speed of these formulae can be improved somewhat, without sacrificing accuracy, by making the small change shown below to every line:

Current form:
78.78*(H1-H0)*(H1-H0<L0-L1 and H0>H1)

Improved form:
78.78*(H0-H1)*(H1-H0<L0-L1)*(H0>H1)

Note that the H1-H0 has changed back to a more natural, intuitive form since there is no need to reverse the sign any longer.

If both of the last two () terms are true, they eval to minus-ones for algebraic purposes, and cancel each other out. If either one of them is false, it becomes a zero and the sign of the rest of that line doesn't matter.

Be sure to change ALL of the terms to match!

Tanstaafl
Posted : Tuesday, December 14, 2004 3:22:34 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
After applying the change mentioned in the last post, as well as one additional change described below, the formula is both tighter and faster. I have set this up on the chart as a custom indicator (27-ema smoothing), and it is VERY close to the "true" internal ADX(14).

DX formula for ONE day (WiMA14,10%error)

Plot it as Custom indicator, and use a 27-day
Exponential Smoothing to get the ADX (this
is exact equiv of 14-day Wilder's Smoothing),
then plot TC's native ADX on the same pane -
you will see that the two agree VERY closely,
but the spacebar moves VERY slowly.

DX = 100*Abs(posDM-negDM) / posDM+negDM)

Note that since the weighting factor is the same
for each day in the series, the terms for the
numerator can be combined, as can the terms for the
denominator. This significantly speeds up the
recalc, without further loss of accuracy.

100*Abs(
78.78*((H1-H2)*(H1-H2>L2-L1)*(H1>H2) - (L2-L1)*(H1-H2<L2-L1)*(L1<L2))
+73.16*((H2-H3)*(H2-H3>L3-L2)*(H2>H3) - (L3-L2)*(H2-H3<L3-L2)*(L2<L3))
+67.93*((H3-H4)*(H3-H4>L4-L3)*(H3>H4) - (L4-L3)*(H3-H4<L4-L3)*(L3<L4))
+63.08*((H4-H5)*(H4-H5>L5-L4)*(H4>H5) - (L5-L4)*(H4-H5<L5-L4)*(L4<L5))
+58.57*((H5-H6)*(H5-H6>L6-L5)*(H5>H6) - (L6-L5)*(H5-H6<L6-L5)*(L5<L6))
+54.39*((H6-H7)*(H6-H7>L7-L6)*(H6>H7) - (L7-L6)*(H6-H7<L7-L6)*(L6<L7))
+50.5*((H7-H8)*(H7-H8>L8-L7)*(H7>H8) - (L8-L7)*(H7-H8<L8-L7)*(L7<L8))
+46.9*((H8-H9)*(H8-H9>L9-L8)*(H8>H9) - (L9-L8)*(H8-H9<L9-L8)*(L8<L9))
+43.55*((H9-H10)*(H9-H10>L10-L9)*(H9>H10) - (L10-L9)*(H9-H10<L10-L9)*(L9<L10))
+40.44*((H10-H11)*(H10-H11>L11-L10)*(H10>H11) - (L11-L10)*(H10-H11<L11-L10)*(L10<L11))
+37.55*((H11-H12)*(H11-H12>L12-L11)*(H11>H12) - (L12-L11)*(H11-H12<L12-L11)*(L11<L12))
+34.87*((H12-H13)*(H12-H13>L13-L12)*(H12>H13) - (L13-L12)*(H12-H13<L13-L12)*(L12<L13))
+32.38*((H13-H14)*(H13-H14>L14-L13)*(H13>H14) - (L14-L13)*(H13-H14<L14-L13)*(L13<L14))
+30.06*((H14-H15)*(H14-H15>L15-L14)*(H14>H15) - (L15-L14)*(H14-H15<L15-L14)*(L14<L15))
+27.92*((H15-H16)*(H15-H16>L16-L15)*(H15>H16) - (L16-L15)*(H15-H16<L16-L15)*(L15<L16))
+25.92*((H16-H17)*(H16-H17>L17-L16)*(H16>H17) - (L17-L16)*(H16-H17<L17-L16)*(L16<L17))
+24.07*((H17-H18)*(H17-H18>L18-L17)*(H17>H18) - (L18-L17)*(H17-H18<L18-L17)*(L17<L18))
+22.35*((H18-H19)*(H18-H19>L19-L18)*(H18>H19) - (L19-L18)*(H18-H19<L19-L18)*(L18<L19))
+20.75*((H19-H20)*(H19-H20>L20-L19)*(H19>H20) - (L20-L19)*(H19-H20<L20-L19)*(L19<L20))
+19.27*((H20-H21)*(H20-H21>L21-L20)*(H20>H21) - (L21-L20)*(H20-H21<L21-L20)*(L20<L21))
+17.9*((H21-H22)*(H21-H22>L22-L21)*(H21>H22) - (L22-L21)*(H21-H22<L22-L21)*(L21<L22))
+16.62*((H22-H23)*(H22-H23>L23-L22)*(H22>H23) - (L23-L22)*(H22-H23<L23-L22)*(L22<L23))
+15.43*((H23-H24)*(H23-H24>L24-L23)*(H23>H24) - (L24-L23)*(H23-H24<L24-L23)*(L23<L24))
+14.33*((H24-H25)*(H24-H25>L25-L24)*(H24>H25) - (L25-L24)*(H24-H25<L25-L24)*(L24<L25))
+13.3*((H25-H26)*(H25-H26>L26-L25)*(H25>H26) - (L26-L25)*(H25-H26<L26-L25)*(L25<L26))
+12.35*((H26-H27)*(H26-H27>L27-L26)*(H26>H27) - (L27-L26)*(H26-H27<L27-L26)*(L26<L27))
+11.47*((H27-H28)*(H27-H28>L28-L27)*(H27>H28) - (L28-L27)*(H27-H28<L28-L27)*(L27<L28))
+10.65*((H28-H29)*(H28-H29>L29-L28)*(H28>H29) - (L29-L28)*(H28-H29<L29-L28)*(L28<L29))
+9.89*((H29-H30)*(H29-H30>L30-L29)*(H29>H30) - (L30-L29)*(H29-H30<L30-L29)*(L29<L30))
+9.18*((H30-H31)*(H30-H31>L31-L30)*(H30>H31) - (L31-L30)*(H30-H31<L31-L30)*(L30<L31))
+8.53*((H31-H32)*(H31-H32>L32-L31)*(H31>H32) - (L32-L31)*(H31-H32<L32-L31)*(L31<L32))
+7.92*((H32-H33)*(H32-H33>L33-L32)*(H32>H33) - (L33-L32)*(H32-H33<L33-L32)*(L32<L33))
) / (
78.78*((H1-H2)*(H1-H2>L2-L1)*(H1>H2) + (L2-L1)*(H1-H2<L2-L1)*(L1<L2))
+73.16*((H2-H3)*(H2-H3>L3-L2)*(H2>H3) + (L3-L2)*(H2-H3<L3-L2)*(L2<L3))
+67.93*((H3-H4)*(H3-H4>L4-L3)*(H3>H4) + (L4-L3)*(H3-H4<L4-L3)*(L3<L4))
+63.08*((H4-H5)*(H4-H5>L5-L4)*(H4>H5) + (L5-L4)*(H4-H5<L5-L4)*(L4<L5))
+58.57*((H5-H6)*(H5-H6>L6-L5)*(H5>H6) + (L6-L5)*(H5-H6<L6-L5)*(L5<L6))
+54.39*((H6-H7)*(H6-H7>L7-L6)*(H6>H7) + (L7-L6)*(H6-H7<L7-L6)*(L6<L7))
+50.5*((H7-H8)*(H7-H8>L8-L7)*(H7>H8) + (L8-L7)*(H7-H8<L8-L7)*(L7<L8))
+46.9*((H8-H9)*(H8-H9>L9-L8)*(H8>H9) + (L9-L8)*(H8-H9<L9-L8)*(L8<L9))
+43.55*((H9-H10)*(H9-H10>L10-L9)*(H9>H10) + (L10-L9)*(H9-H10<L10-L9)*(L9<L10))
+40.44*((H10-H11)*(H10-H11>L11-L10)*(H10>H11) + (L11-L10)*(H10-H11<L11-L10)*(L10<L11))
+37.55*((H11-H12)*(H11-H12>L12-L11)*(H11>H12) + (L12-L11)*(H11-H12<L12-L11)*(L11<L12))
+34.87*((H12-H13)*(H12-H13>L13-L12)*(H12>H13) + (L13-L12)*(H12-H13<L13-L12)*(L12<L13))
+32.38*((H13-H14)*(H13-H14>L14-L13)*(H13>H14) + (L14-L13)*(H13-H14<L14-L13)*(L13<L14))
+30.06*((H14-H15)*(H14-H15>L15-L14)*(H14>H15) + (L15-L14)*(H14-H15<L15-L14)*(L14<L15))
+27.92*((H15-H16)*(H15-H16>L16-L15)*(H15>H16) + (L16-L15)*(H15-H16<L16-L15)*(L15<L16))
+25.92*((H16-H17)*(H16-H17>L17-L16)*(H16>H17) + (L17-L16)*(H16-H17<L17-L16)*(L16<L17))
+24.07*((H17-H18)*(H17-H18>L18-L17)*(H17>H18) + (L18-L17)*(H17-H18<L18-L17)*(L17<L18))
+22.35*((H18-H19)*(H18-H19>L19-L18)*(H18>H19) + (L19-L18)*(H18-H19<L19-L18)*(L18<L19))
+20.75*((H19-H20)*(H19-H20>L20-L19)*(H19>H20) + (L20-L19)*(H19-H20<L20-L19)*(L19<L20))
+19.27*((H20-H21)*(H20-H21>L21-L20)*(H20>H21) + (L21-L20)*(H20-H21<L21-L20)*(L20<L21))
+17.9*((H21-H22)*(H21-H22>L22-L21)*(H21>H22) + (L22-L21)*(H21-H22<L22-L21)*(L21<L22))
+16.62*((H22-H23)*(H22-H23>L23-L22)*(H22>H23) + (L23-L22)*(H22-H23<L23-L22)*(L22<L23))
+15.43*((H23-H24)*(H23-H24>L24-L23)*(H23>H24) + (L24-L23)*(H23-H24<L24-L23)*(L23<L24))
+14.33*((H24-H25)*(H24-H25>L25-L24)*(H24>H25) + (L25-L24)*(H24-H25<L25-L24)*(L24<L25))
+13.3*((H25-H26)*(H25-H26>L26-L25)*(H25>H26) + (L26-L25)*(H25-H26<L26-L25)*(L25<L26))
+12.35*((H26-H27)*(H26-H27>L27-L26)*(H26>H27) + (L27-L26)*(H26-H27<L27-L26)*(L26<L27))
+11.47*((H27-H28)*(H27-H28>L28-L27)*(H27>H28) + (L28-L27)*(H27-H28<L28-L27)*(L27<L28))
+10.65*((H28-H29)*(H28-H29>L29-L28)*(H28>H29) + (L29-L28)*(H28-H29<L29-L28)*(L28<L29))
+9.89*((H29-H30)*(H29-H30>L30-L29)*(H29>H30) + (L30-L29)*(H29-H30<L30-L29)*(L29<L30))
+9.18*((H30-H31)*(H30-H31>L31-L30)*(H30>H31) + (L31-L30)*(H30-H31<L31-L30)*(L30<L31))
+8.53*((H31-H32)*(H31-H32>L32-L31)*(H31>H32) + (L32-L31)*(H31-H32<L32-L31)*(L31<L32))
+7.92*((H32-H33)*(H32-H33>L33-L32)*(H32>H33) + (L33-L32)*(H32-H33<L33-L32)*(L32<L33))
)

Tanstaafl
Posted : Wednesday, December 15, 2004 7:43:21 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
For a very simple method to find +DMI vs -DMI crossovers (the two extra lines in the ADX family), please be sure to review the formulae in this other thread, PARTICULARLY the eleventh (short) posting, which gives a simple, fast and accurate method.

Title: "PCF for Wilder's Directional Movement DMI-crossovers":

Here's the link to it:

PCF for Wilder's Directional Movement DMI-crossovers

Tanstaafl
Posted : Friday, December 17, 2004 11:19:02 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Further info re interp and use of Wilder's ADX (from his 1978 book) ...

Strictly speaking, Wilder evaluated the presence or absence of a Trend by using the ADXR, not the ADX. The ADXR is a simple smoothing of the ADX:
(ADX today + ADX 14daysago) / 2

He said that if the ADXR is above 25, it's a good trend. He said if ADXR is below 20, its not a valid trend. He also suggested that if the ADX is below both the DI lines, it's not a safe trend.

If you use the same rules for the ADX, you can sometimes get into trouble - it will &quot;whipsaw&quot; the Trend indication. So, how do you get the ADXR from TC?

One way is to use the long formula above, twice, with the second instance having day-references incremented by 14. Add those two long formulae, and divide by two, and you have the ADXR (10% error).

An EASIER way, graphically, is to plot a 14-day ROC as a child to the ADX14. The ROC14 (Rate of Change) is simply today's ADX minus ADX 14 days ago.

If you take HALF the ROC14 value and mentally subtract it from the ADX value, voila! you have the ADXR. You can SEE these values easily by plotting the ADX and its ROC in the top pane, and turning on the databox.


Jim Dean

Bruce_L
Posted : Friday, July 29, 2005 11:35:09 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
The formula posted on Saturday, December 11, 2004 1:39:55 AM looks right, but the Tuesday, December 14, 2004 3:22:34 PM formula appears to be calculating the prior day's DX14. The following version should calculate the current value with similar accuracy:

ABS(200/(1+(1393*(L1-L)*(L1>L)*((L1-L)>(H-H1)) +1293*(L2-L1)*(L2>L1)*((L2-L1)>(H1-H2)) +1201*(L3-L2)*(L3>L2)*((L3-L2)>(H2-H3)) +1115*(L4-L3)*(L4>L3)*((L4-L3)>(H3-H4)) +1035*(L5-L4)*(L5>L4)*((L5-L4)>(H4-H5)) +961*(L6-L5)*(L6>L5)*((L6-L5)>(H5-H6)) +893*(L7-L6)*(L7>L6)*((L7-L6)>(H6-H7)) +829*(L8-L7)*(L8>L7)*((L8-L7)>(H7-H8)) +770*(L9-L8)*(L9>L8)*((L9-L8)>(H8-H9)) +715*(L10-L9)*(L10>L9)*((L10-L9)>(H9-H10)) +664*(L11-L10)*(L11>L10)*((L11-L10)>(H10-H11)) +616*(L12-L11)*(L12>L11)*((L12-L11)>(H11-H12)) +572*(L13-L12)*(L13>L12)*((L13-L12)>(H12-H13)) +531*(L14-L13)*(L14>L13)*((L14-L13)>(H13-H14)) +493*(L15-L14)*(L15>L14)*((L15-L14)>(H14-H15)) +458*(L16-L15)*(L16>L15)*((L16-L15)>(H15-H16)) +425*(L17-L16)*(L17>L16)*((L17-L16)>(H16-H17)) +395*(L18-L17)*(L18>L17)*((L18-L17)>(H17-H18)) +367*(L19-L18)*(L19>L18)*((L19-L18)>(H18-H19)) +341*(L20-L19)*(L20>L19)*((L20-L19)>(H19-H20)) +316*(L21-L20)*(L21>L20)*((L21-L20)>(H20-H21)) +294*(L22-L21)*(L22>L21)*((L22-L21)>(H21-H22)) +273*(L23-L22)*(L23>L22)*((L23-L22)>(H22-H23)) +253*(L24-L23)*(L24>L23)*((L24-L23)>(H23-H24)) +235*(L25-L24)*(L25>L24)*((L25-L24)>(H24-H25)) +218*(L26-L25)*(L26>L25)*((L26-L25)>(H25-H26)) +203*(L27-L26)*(L27>L26)*((L27-L26)>(H26-H27)) +188*(L28-L27)*(L28>L27)*((L28-L27)>(H27-H28)) +175*(L29-L28)*(L29>L28)*((L29-L28)>(H28-H29)) +162*(L30-L29)*(L30>L29)*((L30-L29)>(H29-H30)) +151*(L31-L30)*(L31>L30)*((L31-L30)>(H30-H31)) +140*(L32-L31)*(L32>L31)*((L32-L31)>(H31-H32)))/(1393*(H-H1)*(H>H1)*((H-H1)>(L1-L)) +1293*(H1-H2)*(H1>H2)*((H1-H2)>(L2-L1)) +1201*(H2-H3)*(H2>H3)*((H2-H3)>(L3-L2)) +1115*(H3-H4)*(H3>H4)*((H3-H4)>(L4-L3)) +1035*(H4-H5)*(H4>H5)*((H4-H5)>(L5-L4)) +961*(H5-H6)*(H5>H6)*((H5-H6)>(L6-L5)) +893*(H6-H7)*(H6>H7)*((H6-H7)>(L7-L6)) +829*(H7-H8)*(H7>H8)*((H7-H8)>(L8-L7)) +770*(H8-H9)*(H8>H9)*((H8-H9)>(L9-L8)) +715*(H9-H10)*(H9>H10)*((H9-H10)>(L10-L9)) +664*(H10-H11)*(H10>H11)*((H10-H11)>(L11-L10)) +616*(H11-H12)*(H11>H12)*((H11-H12)>(L12-L11)) +572*(H12-H13)*(H12>H13)*((H12-H13)>(L13-L12)) +531*(H13-H14)*(H13>H14)*((H13-H14)>(L14-L13)) +493*(H14-H15)*(H14>H15)*((H14-H15)>(L15-L14)) +458*(H15-H16)*(H15>H16)*((H15-H16)>(L16-L15)) +425*(H16-H17)*(H16>H17)*((H16-H17)>(L17-L16)) +395*(H17-H18)*(H17>H18)*((H17-H18)>(L18-L17)) +367*(H18-H19)*(H18>H19)*((H18-H19)>(L19-L18)) +341*(H19-H20)*(H19>H20)*((H19-H20)>(L20-L19)) +316*(H20-H21)*(H20>H21)*((H20-H21)>(L21-L20)) +294*(H21-H22)*(H21>H22)*((H21-H22)>(L22-L21)) +273*(H22-H23)*(H22>H23)*((H22-H23)>(L23-L22)) +253*(H23-H24)*(H23>H24)*((H23-H24)>(L24-L23)) +235*(H24-H25)*(H24>H25)*((H24-H25)>(L25-L24)) +218*(H25-H26)*(H25>H26)*((H25-H26)>(L26-L25)) +203*(H26-H27)*(H26>H27)*((H26-H27)>(L27-L26)) +188*(H27-H28)*(H27>H28)*((H27-H28)>(L28-L27)) +175*(H28-H29)*(H28>H29)*((H28-H29)>(L29-L28)) +162*(H29-H30)*(H29>H30)*((H29-H30)>(L30-L29)) +151*(H30-H31)*(H30>H31)*((H30-H31)>(L31-L30)) +140*(H31-H32)*(H31>H32)*((H31-H32)>(L32-L31))))-100)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tanstaafl
Posted : Friday, July 29, 2005 12:25:51 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Thanks Bruce.

The original formula for one bar ago was a deliberate choice, since the user already can get today's formula using TC's internal ADX function.

However, if they want to have the ability to find CROSSOVERS, they need a custom indicator solution for one bar ago ...

Of course this depends on the use of the CI's 27-period Exponential smoothing to get to the true ADX ... it's not useful for PCF's.

Jim Dean

Bruce_L
Posted : Friday, July 29, 2005 12:33:15 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (Tanstaafl)
DX formula for ONE day (WiMA14,10%error)

Was that the part that was supposed to signify it was yesterday's DX (maybe with a word left out)?

QUOTE (Tanstaafl)
The original formula for one bar ago was a deliberate choice, since the user already can get today's formula using TC's internal ADX function.

The very first formula seems to calculate the current DX. That must be what confused me. I must admit a much slower Custom Indicator duplicating an existing Indicator that's only going to be used for Indicator Sorts is pretty useless.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tanstaafl
Posted : Friday, July 29, 2005 1:14:57 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
The December 14, 3:22 posting is for one bar ago, and represents the DX value for one bar out of the series that is needed to calc the ADX, using 14-bar Wilder's smoothing (= 27-bar Exponential smoothing).

I should have made a big point about it being one bar ago, and why.

The earlier Dec.11th posting was for the current day, which I admit is confusing.

Thanks for wading thru this. I hope you can convince the powers that be just HOW USEFUL it would be to get an ADXn.m.d function, plus companion PDIn.d and NDIn.d functions!

Jim Dean

stevenbfriedman
Posted : Saturday, July 30, 2005 12:08:56 AM
Registered User
Joined: 12/29/2004
Posts: 12
As a new TC user, I am very disappointed that ADX with +/-DI are not established and good-to-go user-friendly.
Tanstaafl
Posted : Saturday, July 30, 2005 12:46:46 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
As a veteran TC user, so am I.

But there's a lot of other great stuff in TC ... nothing is perfect.

Jim Dean

bustermu
Posted : Saturday, July 30, 2005 9:39:18 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
Jim D. and Bruce,

Please notice that since posDM14 and negDM14 are nonnegative,

DX = ABS(posDM14-negDM14)/(posDM14+negDM14)
= ABS(2/(1+negDM14/posDM14)-1)

The last, all though lacking elegance, may be faster. I personally prefer the elegance.

Speaking of elegance, your approximation of an EMA of Period P using K terms can be written:

a = (P-1)/(P+1)

c = (1-a)/(1-a^K)

and the approximating filter PCF on a data sequence X can be written:

c
*(X0+a
*(X1+a
*(X2+a
*(X3+a
...
*(X(K-2)+a
*(X(K-1))))))...)

in place of:

c*(a^0*X0+a^1*X1+a^2*X2+...+a^(K-1)*X(K-1))

In each case the c, a, and a^k's are calculated off-line. The first is easier, more elegent, involves less off-line computation, more easily adjusted for different periods, and, as we have seen, faster. So why use the second?

I believe that each of you has an off-line program that writes the second PCF for you, but it could just as easily write the first. My guess is that most users do not have such a program and they have to ask one of you for the PCF each time they use a different period. I assume anyone familiar with PCF's could write the first form quite easily if they have a calculator to calculate the constants a and c.

If one has need of an EMA for today and also for yesterday, for example, in crossovers, it appears to me that one should write the PCF for yesterday and use the difference equation to update it to today. This would not compound the approximation error.


Bruce,

Notice that:

(-1)*(H0>H1 OR L1>L0) = 1-(H0<=H1)*(L1<=L0)

and the right-side is faster.

Thanks,
Jim Murphy
Bruce_L
Posted : Saturday, July 30, 2005 2:51:45 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
bustermu,
Thanks! I've decided under these circumstances, size and speed are more important than elegance (and have altered my earlier post to use the less elegant optimization). Since I was only using (H>H1 OR L1>L) to allow using H-H1+L1-L+ABS(H-H1-L1+L), and was only doing that because it made finding the sum and difference of posDM14 and negDM14 shorter and faster, I won't need the last optimization, but I'll keep it in mind for future use.

The more elegant approach you presented is very useful for those wishing to write their own Personal Criteria Formula with minimal pre-computation. It is much easier to use when adjusting the period by hand.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bustermu
Posted : Wednesday, August 3, 2005 9:16:10 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
We have written DX in the form:

DX = 100*ABS(2/(1+negDM14/posDM14)-1)

From my previous post, if P = 2*14-1 = 27, then

a = (P-1)/(P+1)
= 13/14

and the c's cancel.

If we use 32 terms for posDM14 and negDM14, the DX can be written:

100*ABS(2/(1
+((L1-L0)*(L1>L0)*((L1-L0)>(H0-H1))+(13/14)
*((L2-L1)*(L2>L1)*((L2-L1)>(H1-H2))+(13/14)
*((L3-L2)*(L3>L2)*((L3-L2)>(H2-H3))+(13/14)
*((L4-L3)*(L4>L3)*((L4-L3)>(H3-H4))+(13/14)
*((L5-L4)*(L5>L4)*((L5-L4)>(H4-H5))+(13/14)
*((L6-L5)*(L6>L5)*((L6-L5)>(H5-H6))+(13/14)
*((L7-L6)*(L7>L6)*((L7-L6)>(H6-H7))+(13/14)
*((L8-L7)*(L8>L7)*((L8-L7)>(H7-H8))+(13/14)
*((L9-L8)*(L9>L8)*((L9-L8)>(H8-H9))+(13/14)
*((L10-L9)*(L10>L9)*((L10-L9)>(H9-H10))+(13/14)
*((L11-L10)*(L11>L10)*((L11-L10)>(H10-H11))+(13/14)
*((L12-L11)*(L12>L11)*((L12-L11)>(H11-H12))+(13/14)
*((L13-L12)*(L13>L12)*((L13-L12)>(H12-H13))+(13/14)
*((L14-L13)*(L14>L13)*((L14-L13)>(H13-H14))+(13/14)
*((L15-L14)*(L15>L14)*((L15-L14)>(H14-H15))+(13/14)
*((L16-L15)*(L16>L15)*((L16-L15)>(H15-H16))+(13/14)
*((L17-L16)*(L17>L16)*((L17-L16)>(H16-H17))+(13/14)
*((L18-L17)*(L18>L17)*((L18-L17)>(H17-H18))+(13/14)
*((L19-L18)*(L19>L18)*((L19-L18)>(H18-H19))+(13/14)
*((L20-L19)*(L20>L19)*((L20-L19)>(H19-H20))+(13/14)
*((L21-L20)*(L21>L20)*((L21-L20)>(H20-H21))+(13/14)
*((L22-L21)*(L22>L21)*((L22-L21)>(H21-H22))+(13/14)
*((L23-L22)*(L23>L22)*((L23-L22)>(H22-H23))+(13/14)
*((L24-L23)*(L24>L23)*((L24-L23)>(H23-H24))+(13/14)
*((L25-L24)*(L25>L24)*((L25-L24)>(H24-H25))+(13/14)
*((L26-L25)*(L26>L25)*((L26-L25)>(H25-H26))+(13/14)
*((L27-L26)*(L27>L26)*((L27-L26)>(H26-H27))+(13/14)
*((L28-L27)*(L28>L27)*((L28-L27)>(H27-H28))+(13/14)
*((L29-L28)*(L29>L28)*((L29-L28)>(H28-H29))+(13/14)
*((L30-L29)*(L30>L29)*((L30-L29)>(H29-H30))+(13/14)
*((L31-L30)*(L31>L30)*((L31-L30)>(H30-H31))+(13/14)
*((L32-L31)*(L32>L31)*((L32-L31)>(H31-H32))
))))))))))))))))))))))))))))))))
/((H0-H1)*(H0>H1)*((H0-H1)>(L1-L0))+(13/14)
*((H1-H2)*(H1>H2)*((H1-H2)>(L2-L1))+(13/14)
*((H2-H3)*(H2>H3)*((H2-H3)>(L3-L2))+(13/14)
*((H3-H4)*(H3>H4)*((H3-H4)>(L4-L3))+(13/14)
*((H4-H5)*(H4>H5)*((H4-H5)>(L5-L4))+(13/14)
*((H5-H6)*(H5>H6)*((H5-H6)>(L6-L5))+(13/14)
*((H6-H7)*(H6>H7)*((H6-H7)>(L7-L6))+(13/14)
*((H7-H8)*(H7>H8)*((H7-H8)>(L8-L7))+(13/14)
*((H8-H9)*(H8>H9)*((H8-H9)>(L9-L8))+(13/14)
*((H9-H10)*(H9>H10)*((H9-H10)>(L10-L9))+(13/14)
*((H10-H11)*(H10>H11)*((H10-H11)>(L11-L10))+(13/14)
*((H11-H12)*(H11>H12)*((H11-H12)>(L12-L11))+(13/14)
*((H12-H13)*(H12>H13)*((H12-H13)>(L13-L12))+(13/14)
*((H13-H14)*(H13>H14)*((H13-H14)>(L14-L13))+(13/14)
*((H14-H15)*(H14>H15)*((H14-H15)>(L15-L14))+(13/14)
*((H15-H16)*(H15>H16)*((H15-H16)>(L16-L15))+(13/14)
*((H16-H17)*(H16>H17)*((H16-H17)>(L17-L16))+(13/14)
*((H17-H18)*(H17>H18)*((H17-H18)>(L18-L17))+(13/14)
*((H18-H19)*(H18>H19)*((H18-H19)>(L19-L18))+(13/14)
*((H19-H20)*(H19>H20)*((H19-H20)>(L20-L19))+(13/14)
*((H20-H21)*(H20>H21)*((H20-H21)>(L21-L20))+(13/14)
*((H21-H22)*(H21>H22)*((H21-H22)>(L22-L21))+(13/14)
*((H22-H23)*(H22>H23)*((H22-H23)>(L23-L22))+(13/14)
*((H23-H24)*(H23>H24)*((H23-H24)>(L24-L23))+(13/14)
*((H24-H25)*(H24>H25)*((H24-H25)>(L25-L24))+(13/14)
*((H25-H26)*(H25>H26)*((H25-H26)>(L26-L25))+(13/14)
*((H26-H27)*(H26>H27)*((H26-H27)>(L27-L26))+(13/14)
*((H27-H28)*(H27>H28)*((H27-H28)>(L28-L27))+(13/14)
*((H28-H29)*(H28>H29)*((H28-H29)>(L29-L28))+(13/14)
*((H29-H30)*(H29>H30)*((H29-H30)>(L30-L29))+(13/14)
*((H30-H31)*(H30>H31)*((H30-H31)>(L31-L30))+(13/14)
*((H31-H32)*(H31>H32)*((H31-H32)>(L32-L31))
))))))))))))))))))))))))))))))))
) -1)

The DX given by Jim Dean is very close in value to the above. The DX given by Bruce is a little off in value. This appears to be due to his rounding of the filter coefficients and not an error in form.

It is easy to change the period and the number of terms used for the filter in the above PCF for DX.

Thanks,
Jim Murphy
Bruce_L
Posted : Wednesday, August 3, 2005 10:36:53 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
bustermu,
First, let me say admire the formula you presented. It is a valuable addition to the forums. The nested terms are both more elegant and easier to alter by hand than pre-calculating the coefficients (and leaves any rounding to TeleChart, avoiding the issue of the next two paragraphs). Not only that, at 32 terms, I wasn’t able to measure a difference in calculation time with my stopwatch between your form and mine when updating only DX14 for All Items in System (both came in at between 3.5 and 4.0 seconds). I don’t know how calculation times would compare with more terms or a slower computer (I’m wondering about the increased number of parenthesis).

The rounding issue in the pre-calculated forms is one that I have wrestled with. There is an entry in my spreadsheet that limits both the number of terms and the rounding of the coefficients (let’s call it L%). It stops adding terms when the sum of the unaltered coefficients first exceeds L%. It has also been setting the value of the smallest coefficient to 1/(1-L%) and rounding the coefficients to the nearest whole number. So, with Wilder’s Smoothing, setting L% = 0.9 means there will be 32 terms and the smallest coefficient will be 10. This seemed at the time like a reasonable accuracy for the coefficients considering the formula throws away terms that would otherwise contribute 1-L% of the value anyway.

I don’t want to just arbitrarily multiply the values by ten or something similar, so I’ve decided to divide the values I’ve been using by the unadjusted coefficient of the first term. With Wilder’s Smoothing, that means multiplying the old coefficients by the Period (in the example above, the smallest coefficient changes from 10 to 140). It may seem just arbitrary and not make all that much sense, but slowing the changes to the coefficients does increase the accuracy required to differentiate the coefficients. There may be a better way to determine just how much rounding to use (and I'm interested in suggestions), but just throwing more digits at it to increase the accuracy seems quite silly when the formula is already an approximation.

I've altered my previous formula to reflect the change.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tanstaafl
Posted : Wednesday, August 3, 2005 11:52:05 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Hi, Bruce:

FWIW, for a long time my signif-figure paradigm has involved checking the logarithm of the biggest and smallest "raw" coefficients in the series, then multiplying each coeff by an approp power of ten to reduce unnecessary leading zeros, then dividing by that same power of ten at the end.

The net sum of all the coefficients should be 1.0000, after the tens cancel, and they should (IMO) all be scaled up or down proportionately.

Re your comments about the paren's ... I think that the fact that JimM's calc is essentially two instances of the DM series, and the original versions used four instances, where both versions had roughly equal amounts of boolean logic per term, would indicate by rough standards that the calc time *should* be about 30-40% less for JimM's streamlined math, barring the effect of the deeply-nested paren's. So, it *might* be appropriate to conclude that the paren-nesting method, rather than the series-expansion method that we have both been using in the past, does add a meaningful calc time hit.

In this case, since JimM's form is so much easier for a non-XL user to manipulate, I think that the calc time hit is not an issue. If someone were to run out the DX for a periods input of 100 rather than 14, which would call for about 250 terms rather than 32, then I suspect that the time difference might be more significant in the decision.

Jim Dean

P.S. JimM ... congrats and kudos, once again, for providing a much simplified form of the math to help the community out!

bustermu
Posted : Wednesday, August 3, 2005 4:16:45 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Bruce and Jim D.,

I do not know, but I have never heard programers even mention parentheses when computation time is of concern. There is evidence that parentheses can decrease computation time very significantly in TC2005 for some unknown reason. Please see:

Computation Time for Parentheses

This is the reason I have contended that the parentheses-nested PCF for EMA's is faster in TC2005.

You will please notice that 62 unnecessary divides, 13/14, were left in the PCF for DX. They were left in for clarity, but there was no noticable decrease in testing time when they were replaced. (If 62 divides don't matter, what does?) Jim Dean's DX took almost 5 times as long to test, but most of that was probably due to the AND's.

Bruce's PCF for DX now gives close to the same values as the one I presented.

Thanks,
Jim Murphy
Bruce_L
Posted : Wednesday, August 3, 2005 4:33:39 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I believe reading the mentioned topic is what got me thinking parentheses had a significant impact on computation time in TeleChart in the first place. I just somehow misread it as having a negative impact because the idea that arbitrarily adding parentheses to an equation would decrease the time required just didn’t fit in with my concept of reality. I've even written slightly longer versions of some formulas in order to eliminate parentheses as a result.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tanstaafl
Posted : Wednesday, August 3, 2005 5:14:20 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Jim M:

I have discussed this paren thing at great length before, at your request.

If you have discussed this with programmers before, you might go back to those programmers and ask them if they have ever written a COMPILER or not, and whether they can code in ASSEMBLY language.

My postulated comments are based on my personal experience (albeit a few decades ago) in both of those CompSci arenas.

The only way to know for sure to find out how this impacts TC is to write the formula two ways, with the same accuracy and math paradigm, for the nested method and for the series method, then time it thru TC's calc engine.

I don't have time now to code up your alternative syntax to gen the other equation, but when I do I will report the timetrial results here.

Jim Dean

bustermu
Posted : Thursday, August 4, 2005 4:29:45 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (Tanstaafl)

The only way to know for sure to find out how this impacts TC is to write the formula two ways, with the same accuracy and math paradigm, for the nested method and for the series method, then time it thru TC's calc engine.


I have done that and the nested parentheses form of an EMA approximation is faster.

The following is a copy of Message 2247 on the auxiliary board:

From: bustermu
Date: Mon Mar 28, 2005 5:52 am
Subject: Re: Computation Time for Parentheses

Jim D.,

Please consider the two PCF's approximating EMA(V*(C-C1),3):

1) 0.001*(500.0305*(V0*(C0-C1))+250.0153*(V1*(C1-C2))
+125.0076*(V2*(C2-C3))+62.5038*(V3*(C3-C4))+31.2519*(V4*(C4-C5))
+15.626*(V5*(C5-C6))+7.813*(V6*(C6-C7))+3.9065*(V7*(C7-C8))
+1.9532*(V8*(C8-C9)) +.9766*(V9*(C9-C10))+.4883*(V10*(C10-C11))
+.2442*(V11*(C11-C12)) +.1221*(V12*(C12-C13))
+.061*(V13*(C13-C14)))

2) 0.500030519
*(V0*(C0-C1)+0.5
*(V1*(C1-C2)+0.5
*(V2*(C2-C3)+0.5
*(V3*(C3-C4)+0.5
*(V4*(C4-C5)+0.5
*(V5*(C5-C6)+0.5
*(V6*(C6-C7)+0.5
*(V7*(C7-C8)+0.5
*(V8*(C8-C9)+0.5
*(V9*(C9-C10)+0.5
*(V10*(C10-C11)+0.5
*(V11*(C11-C12)+0.5
*(V12*(C12-C13)+0.5
*(V13*(C13-C14)))))))))))))))

I made the measurements of computation times because of your claim
that 1) will calculate faster than 2). I fully expected that to be
true, but I did not expect to be able to conclude that through
external measurements. Much to my surprise, 2) is faster than 1).
All measurements I made were identical on TC2000 Version 5.3 and on
TC2005. This becomes significant as the period, P, and,
consequently, the number of terms, K, increases.

For large K, speed was supposedly the only redeeming feature of the
form 1). That feature can be reclaimed by appropriately placing
parentheses in the form 1), fewer than in the form 2).

Any comments will be appreciated.

Thanks,
Jim Murphy

End of copy.

Thanks,
Jim Murphy
Tanstaafl
Posted : Thursday, August 4, 2005 7:50:29 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Hi, JimM:

Having had this discussion several times now in several places and quite a few posts, I sort of regret having brought it up - and having promulgated it. There are no firm/sure answers possible, since W is not about to expose the source code for their parser/compiler, and even if they did, only a couple of people would be interested.

I think that the various tests done have adequately illustrated that the impact of nested paren's is negligible compared to other factors.

So, I am personally done talking about this. It's reached the beating the dead horse phase.

Thanks for your tests and comments.

Jim Dean

buycycle
Posted : Wednesday, May 21, 2008 11:39:19 AM
Gold Customer Gold Customer

Joined: 3/22/2005
Posts: 11
Can anyone suggest a way to visually sort the -DI and +DI for a ADX 9 prd, 30 avg?  I'm looking for the "relative visual value placement" in the window pane.  (Upper or lower quadrant placement.)  Not an empirical calculated number.
Bruce_L
Posted : Thursday, May 22, 2008 8:49:28 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
buycycle,
Tanstaafl suggests a method of comparing the two value in his Wednesday, December 15, 2004 7:35:09 AM ET post in PCF for Wilder's Directional Movement DMI-crossovers. That said, I cannot think of practical method for determining where they are in the Pane in TeleChart besides visual inspection (it is much easier in Blocks).

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Munir_Abdalnabi
Posted : Thursday, September 23, 2010 11:16:21 AM
Registered User
Joined: 5/18/2009
Posts: 3
Bruce,

I want to look for stocks with top 30 RS( not RSI)  in the S&P-500 that also have inceasing average volume for the last month comparing to the the average volume of the last six months.

Thanks.
Bruce_L
Posted : Thursday, September 23, 2010 11:30:58 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Munir_Abdalnabi,
You could create a Personal Criteria Formula for Volume Surge comparing the current month to the previous six months:

How to create a Personal Criteria Forumula (PCF)

100 * AVGV21 / AVGV126.21

And use it as an EasyScan Condition along with the built in Relative Strength 1-Yr (vs SP-500) System Criteria with the EasyScan Rangefinders for both set to high values.

Using EasyScan to find stocks that meet your own criteria
Definitions of all built in scanning and sorting criteria

That said, I do not know of a way to limit the results to exactly symbols.

On another note, your question is entirely unrelated to the topic in which it was asked. It is generally better to start new topics for unrelated questions and only make posts that are directly related to the topic being discussed within an existing topic.

Learn how to use the forums: post a new topic, reply, Search existing topics

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.