Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Moving Average Crossover using trend strength Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
traderc
Posted : Wednesday, October 17, 2018 3:31:53 PM
Registered User
Joined: 10/7/2004
Posts: 86

Bruce, in my qwest in finding the holy grail market timing, ha,ha I am looking at a filtered dual moving average crossover. The filter to remove false signals is the ADX for trend strength. There would be different settings for Market up or Market down signals against the major indexes(SPX,QQQ,VTI). What I was wondering is whether you could frame this out so I could test the differnet length variables, for now pick the easiest and shortest lengths. I'm not sure how to smooth the Slow moving average with the ADX. Any guidence you could shed would be a great help. I will keep researching as well.

thanks,

rctrade

Bruce_L
Posted : Wednesday, October 17, 2018 4:34:49 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Are you trying to use ADX applied to price as a second condition or do you want to change the data source of ADX to use the MACD signal line instead of price?



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
traderc
Posted : Thursday, October 18, 2018 2:47:11 PM
Registered User
Joined: 10/7/2004
Posts: 86

Bruce, sorry for not providing more details.. 

"The filter(ADX) is applied to the slow moving average and reduces the likelihood of reducing false crossovers signals. Because minor fluctuations about the slow average are relatively constant in amplitude,  the filter is calculated as a percentage slightly greater than the normal amplitude fluctuation". 

ref: Market Timing and walk foward optimizing, Charles D Kirkpatrick

So as I read this and try to answer your question, I beleive it's ADX applied to SMA of Price.

Hopefully this helps...

Thanks

rctrade

 

Bruce_L
Posted : Thursday, October 18, 2018 3:00:35 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Then try adding ADX to the charts and then changing its data source to use the signal or trigger line of the MACD instead of Price History.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
traderc
Posted : Thursday, October 18, 2018 6:26:49 PM
Registered User
Joined: 10/7/2004
Posts: 86

Will do    thanks

rctrade

traderc
Posted : Friday, October 19, 2018 10:55:10 AM
Registered User
Joined: 10/7/2004
Posts: 86

Bruce  - here's what I did,  I must of misunderstood your directions cause I'm not getting an indicator display.

rctrade

 

Bruce_L
Posted : Friday, October 19, 2018 2:51:09 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Unfortunately you actually did follow my suggestion, but it didn't work. I hadn't tested it because I am on vacation. It should have worked. I am not quite sure why it doesn't work, but we can write a formula for this.

100 * XAVG(ABS(XAVG(IIF(XAVG(MACD12.26, 9) > XAVG(MACD12.26.1, 9), XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9), 0), 27) - XAVG(IIF(XAVG(MACD12.26, 9) < XAVG(MACD12.26.1, 9), XAVG(MACD12.26.1, 9) - XAVG(MACD12.26, 9), 0), 27)) / XAVG(ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9)), 27), 27)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
traderc
Posted : Friday, October 19, 2018 2:54:36 PM
Registered User
Joined: 10/7/2004
Posts: 86

 Thanks Bruce and next time you are on vacation don't check this site.... :-)

Will give it a shot...

rctrade

traderc
Posted : Monday, October 22, 2018 7:19:03 PM
Registered User
Joined: 10/7/2004
Posts: 86

Bruce  you are  amazing, I went  through the  code to understand, since  worden has  ADX as a built in didn't  know how to handle it. But let me see if I understand it.

So,

1. ADX = 100* EMA(ABS((+DI minus - DI)/+DI plus -DI))

2. +DM = C(H)-C(H,1)      - Positive Directional movement

3. - DM =  C(l)-C(l,1)         - Negative Directional Movement

4. If +DM>0 and -DM then + DM, else 0

5. If -DM >0 and +DM then -DM, else 0

6. +DI = 100* EMA(+DM/ATR(x))  where ATR is XAVG(ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9)), 27), 27)????  - is this the Average True Range formula?

7. The MACD's are used as the moving average crossovers I presume.

If you look at the plot it doesn't make sense at  #1 and #2.

Maybe #1 needs more data prior to the swing up. But 2 looks divergent with what I expected.

I did not modify any time frames until I understand the logic.

Any thoughts on the plot?

Thanks

rctrade

 

Bruce_L
Posted : Tuesday, October 23, 2018 12:04:19 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I guess I should have saved my work so I didn't have to re-do it (or included it in the original post).

n = Period
TR = MAX(H-L,H-C1,C1-L)
ATRn = (Yesterday_ATRn*(n-1)+TR)/n
+DM = IF H>H1 AND H-H1>L1-L THEN H-H1 ELSE 0
-DM = IF L1>L AND L1-L>H-H1 THEN L1-L ELSE 0
+DMIn = (Yesterday_+DMIn*(n-1)+(+DM))/n
-DMIn = (Yesterday_-DMIn*(n-1)+(-DM))/n
+DIn = 100*(+DMIn)/ATRn
-DIn = 100*(-DMIn)/ATRn
DXn = 100*ABS((+DIn)-(-DIn))/((+DIn)+(-DIn))
ADXn = (Yesterday_ADXn*(n-1)+DXn)/n
ADXRn = (ADXn+nDaysAgo_ADXn)/2

You may alternately calculate ATRn, +DMIn, -DMIn and ADXn as follows:

ATRn = XAVG(TR,(2*n-1))
+DMIn = XAVG(+DM,(2*n-1))
-DMIn = XAVG(-DM,(2*n-1))
ADXn = XAVG(DXn,(2*n-1))

We are going to use the alternate method using the exponential moving averages since it is easier in this instance and produces the same results. And we won't calculate ADXR since it isn't needed. Keeping in mind that the moving average of MACD isn't going to have highs or lows, here we go.

n = 14
TR = ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9))
ATRn = XAVG(ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9)), 27)
+DM = IIF(XAVG(MACD12.26, 9) > XAVG(MACD12.26.1, 9), XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9), 0)
-DM = IIF(XAVG(MACD12.26, 9) < XAVG(MACD12.26.1, 9), XAVG(MACD12.26.1, 9) - XAVG(MACD12.26, 9), 0)
+DMIn = XAVG(IIF(XAVG(MACD12.26, 9) > XAVG(MACD12.26.1, 9), XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9), 0), 27)
-DMIn = XAVG(IIF(XAVG(MACD12.26, 9) < XAVG(MACD12.26.1, 9), XAVG(MACD12.26.1, 9) - XAVG(MACD12.26, 9), 0), 27)
+DIn = 100 * XAVG(IIF(XAVG(MACD12.26, 9) > XAVG(MACD12.26.1, 9), XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9), 0), 27) / XAVG(ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9)), 27)
-DIn = 100 * XAVG(IIF(XAVG(MACD12.26, 9) < XAVG(MACD12.26.1, 9), XAVG(MACD12.26.1, 9) - XAVG(MACD12.26, 9), 0), 27) / XAVG(ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9)), 27)
DXn = 100 * ABS(XAVG(IIF(XAVG(MACD12.26, 9) > XAVG(MACD12.26.1, 9), XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9), 0), 27) - XAVG(IIF(XAVG(MACD12.26, 9) < XAVG(MACD12.26.1, 9), XAVG(MACD12.26.1, 9) - XAVG(MACD12.26, 9), 0), 27)) / XAVG(ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9)), 27)
ADXn = 100 * XAVG(ABS(XAVG(IIF(XAVG(MACD12.26, 9) > XAVG(MACD12.26.1, 9), XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9), 0), 27) - XAVG(IIF(XAVG(MACD12.26, 9) < XAVG(MACD12.26.1, 9), XAVG(MACD12.26.1, 9) - XAVG(MACD12.26, 9), 0), 27)) / XAVG(ABS(XAVG(MACD12.26, 9) - XAVG(MACD12.26.1, 9)), 27), 27)

Note that quite a bit of shortening happens at some of these steps because there are common denominators.

Also note that an ADX measures the strength of the trend. So the higher the value, the stronger the trend. Since it is being applied to the moving average of MACD, it will have low values when MACD is generally level and high values when MACD is moving up or down in the same general direction over time.

If you just want an ADX of the price, it is just the following (and you could just plot the ADX and possibly the Directional Movement indicator on the chart without using a formula).

ADX14.14



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
traderc
Posted : Wednesday, October 24, 2018 7:10:07 AM
Registered User
Joined: 10/7/2004
Posts: 86

Thanks Bruce I will go through through your  great analysis. Be back in about a month or so... :-)

rctrade

Bruce_L
Posted : Wednesday, October 24, 2018 8:36:37 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-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.