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