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 |

Setting up a DEMA MACD Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Stmjd74
Posted : Sunday, September 4, 2005 2:15:04 AM
Registered User
Joined: 12/18/2004
Posts: 180
Does anyone out there have any experience with a DEMA MACD? If so, I am not sure how to set that up on TC GOLD. Is it worth the trouble?
Stmjd74
Posted : Sunday, September 4, 2005 2:30:12 AM
Registered User
Joined: 12/18/2004
Posts: 180
I should be a little more specific here. I am trying to set up a DEMA-based MACD system using the parameters of 8,17 and trigger-line 6. Any help and advice is much appreciated.

John
Craig_S
Posted : Sunday, September 4, 2005 6:24:13 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
I'm finding some information on DEMA.

Do you want a MACD of two DEMA averages or a dema smoothed MACD of two averages?

- Craig
Here to Help!
Stmjd74
Posted : Sunday, September 4, 2005 7:10:17 AM
Registered User
Joined: 12/18/2004
Posts: 180
I would like to calculate both the MACD and the trigger using DEMA rather than traditional exponential moving averages. I think this is what Patrick Mulloy (who introduced DEMA) used to do. Also, if you could, tell me what you mean by a "DEMA smoothed MACD of two averages"? I may want to try this, too. I just want to see if this method is any better than the traditional method. There is also a Jurik (JMA) method of calculating moving averages out now, but the formula is a secret (to me anyway), and you have to buy the software to have access to it.
Craig_S
Posted : Sunday, September 4, 2005 8:43:43 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
MACD is the difference of two moving averages.

DEMA is a way to calculate a moving average.

You could use DEMA to:

1. Calculate the two moving averages that are used to create the MACD
or
2. Smooth the MACD of two standard averages
or
3. Just plot an average of the MACD (what you call a signal line)
or
4. All or some of the above

The final MACD line is culmination of many things being averages starting with averages of price. I am not sure how many of these averages should be DEMA.

Check out this video on how MACD is constructed if the above is confusing...

Understanding MACD

I am still trying to find the exact formula for calculating DEMA. I don't have the article you site. Could you look up how DEMA is calculated and share it here so I can work off of it (once you decide where you want DEMA used within MACD)?


- Craig
Here to Help!
Stmjd74
Posted : Sunday, September 4, 2005 12:20:35 PM
Registered User
Joined: 12/18/2004
Posts: 180
A DEMA moving average is calculated as follows:
(2*n-day EMA)-(n-day EMA of EMA)
For a 50-day moving average using the packaged EMA function, this would be XAVGC50*2-XAVG(XAVGC50,50). Now, as far as how to calculate the MACD using DEMA instead of traditional EMA, I am really not sure. That is what I was hoping you could help me with. I did try plotting the moving average, and it was much more responsive to price than the traditional EMA, but I have yet to try the MACD. My guess is that the fast line would be (2*XAVGC8-XAVG(XAVGC8,8))-(2*XAVGC17-XAVG(XAVGC17,17)). The information I have is from Achelis' "Technical Analysis From A to Z" second edition. Achelis states that he tested the traditional MACD system vs. a DEMA MACD system where both the MACD and the trigger were calculated using the DEMA rather than the traditional EMA. He then goes on to say that during the period from 1995 to 1999, the DEMA was significantly better, although it generated 60% more trades (by crossing up and down through the trigger line). So, it sounds to me like DEMA is used to calculate all of the components of the MACD, including the moving average of MACD (or trigger line), but I'm not really sure. If so, the trigger line might be a pain in the ...!

Thanks,

John
bustermu
Posted : Saturday, September 10, 2005 7:23:25 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (Stmjd74)
Does anyone out there have any experience with a DEMA MACD? If so, I am not sure how to set that up on TC GOLD. Is it worth the trouble?


John,

Since no one has responded affirmatively to your question, I will. Yes, I have experience with DEMA MACD and find it interesting (whatever difference that makes}. I did not until now know that it had a name. I also look at LRMA MACD, but am partial to the DEMA MACD.

Notice that both use Zero-Lag MA's. Please see:

Lag Efficient Moving Average

The PCF I use is:

2*(XAVGC5-XAVGC10)-(XAVG(XAVGC5,5)-XAVG(XAVGC10,10))

Thus, we are in agreement.

A PCF for the trigger line, or, preferably, the histogram, can be written using the results in:

Cascades of Moving Averages

Thanks,
Jim Murphy
Bruce_L
Posted : Saturday, September 10, 2005 8:19:59 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Stmjd74,
I did these formulas incorrectly by hand (and won't be attempting to do anything else this complex without a spreadsheet anytime soon). The DEMA MACD Line is correct, but the Trigger Line is an EMA instead of a DEMA (see my Monday, September 12, 2005 7:20:10 AM post for corrected versions):

DEMA MACD Line (8,17):
2 * XAVGC8 + XAVG(XAVGC17,17) - 2 * XAVGC17 - XAVG(XAVGC8,8)

EMA Trigger of DEMA MACD (8,17,6):
63 / 4 * XAVGC8 - 432 / 121 * XAVGC17 - 4905 / 484 * XAVGC6 - 7 / 2 * XAVG(XAVGC8,8) + 16 / 11 * XAVG(XAVGC17,17)

You really can't use the two formulas above as a combined Custom Indicator replacement for MACD because they will plot on different scales. You are probably going to have to plot your DEMA MACD as a "Histogram" if you want a visible indicator (but it will actually plot as a line).

DEMA MACD - EMA Trigger Histogram (8,17,6):
190 / 121 * XAVGC17 + 4905 / 484 * XAVGC6 + 5 / 2 * XAVG(XAVGC8,8) - 55 / 4 * XAVGC8 - 5 / 11 * XAVG(XAVGC17,17)

You will want to check Center Zero Line when plotting any of the above formulas on the charts (remembering that the first two can't be visibly compared to each other).

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bustermu
Posted : Saturday, September 10, 2005 10:34:29 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
Bruce,

You can't do that that fast!

A mathematician would recognize that we are in a commutative linear operator algebra. Using obvious notation, we have the special property

EP*EQ = ((P-1)/(P-Q))*EP+((Q-1)/(Q-P))*EQ, P <> Q.

With the definition

DP = 2*EP-EP^2

The worst term in the Histogram,

Hist = (I-DR)*(DP-DQ),

is of the form ER^2*EP^2 which can be written

ER^2*EP^2 = (ER*EP)^2
= [((R-1)/(R-P))*ER+((P-1)/(P-R))*EP]^2
= ((R-1)/(R-P))^2*ER^2 +2*((R-1)/(R-P))*((P-1)/(P-R))*ER*EP+((P-1)/(P-R))^2*EP^2

and you are home free in the PCF Language.

My guess is that you already know all that stuff or you would still be with your pencil and paper. Am I correct, or do you take the Fifth?

Should you delete this stuff after I acknowledge your response?

Thanks,
Jim Murphy
bustermu
Posted : Saturday, September 10, 2005 2:15:44 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Bruce,

Your PCF's are such that the trigger MA is an EMA6 rather a DEMA6. My results agree with yours numerically when I use EMA6 rather than DEMA6.

John indicates that DEMA6 should be used instead of EMA6.

Thanks,
Jim Murphy
Stmjd74
Posted : Saturday, September 10, 2005 2:18:06 PM
Registered User
Joined: 12/18/2004
Posts: 180
Glad I just logged in here. Thanks a bunch Jim and Bruce! I'm going to look into all of this as soon as possible.
Stmjd74
Posted : Sunday, September 11, 2005 12:58:56 PM
Registered User
Joined: 12/18/2004
Posts: 180
Awesome, Bruce! Awesome! I did the long-serious EMA calc, and your line fit mine perfectly, same values and all! The formula I wrote took up over a page and a half (2.5x11), and caused my system to choke twice. An example is DPH, value=-.07 with both formulas. Here is the formula I used, just so anyone wondering will know that they are the same (may not want to try it though...)

2*(XAVGC8 -XAVGC17) -(XAVG(XAVGC8,8) -XAVG(XAVGC17,17)) -(2*(.01*(28.5714*(2*(XAVGC8 -XAVGC17) -(XAVG(XAVGC8,8) -XAVG(XAVGC17,17))) +20.4082*(2*(XAVGC8.1 -XAVGC17.1) -(XAVG(XAVGC8.1,8) -XAVG(XAVGC17.1,17))) +14.5773*(2*(XAVGC8.2 -XAVGC17.2) -(XAVG(XAVGC8.2,8) -XAVG(XAVGC17.2,17))) +10.4123*(2*(XAVGC8.3 -XAVGC17.3) -(XAVG(XAVGC8.3,8) -XAVG(XAVGC17.3,17))) +7.4374*(2*(XAVGC8.4 -XAVGC17.4) -(XAVG(XAVGC8.4,8) -XAVG(XAVGC17.4,17))) +5.3124*(2*(XAVGC8.5 -XAVGC17.5) -(XAVG(XAVGC8.5,8) -XAVG(XAVGC17.5,17))) +3.7946*(2*(XAVGC8.6 -XAVGC17.6) -(XAVG(XAVGC8.6,8) -XAVG(XAVGC17.6,17))) +2.7104*(2*(XAVGC8.7 -XAVGC17.7) -(XAVG(XAVGC8.7,8) -XAVG(XAVGC17.7,17))) +1.9360*(2*(XAVGC8.8 -XAVGC17.8) -(XAVG(XAVGC8.8,8) -XAVG(XAVGC17.8,17))) +1.3829*(2*(XAVGC8.9 -XAVGC17.9) -(XAVG(XAVGC8.9,8) -XAVG(XAVGC17.9,17))) +.9878*(2*(XAVGC8.10 -XAVGC17.10) -(XAVG(XAVGC8.10,8) -XAVG(XAVGC17.10,17))) +.7055*(2*(XAVGC8.11 -XAVGC17.11) -(XAVG(XAVGC8.11,8) -XAVG(XAVGC17.11,17))) +.504*(2*(XAVGC8.12 -XAVGC17.12) -(XAVG(XAVGC8.12,8) -XAVG(XAVGC17.12,17))) +.36*(2*(XAVGC8.13 -XAVGC17.13) -(XAVG(XAVGC8.13,8) -XAVG(XAVGC17.13,17))) +.2571*(2*(XAVGC8.14 -XAVGC17.14) -(XAVG(XAVGC8.14,8) -XAVG(XAVGC17.14,17))) +.1837*(2*(XAVGC8.15 -XAVGC17.15) -(XAVG(XAVGC8.15,8) -XAVG(XAVGC17.15,17))) +.1312*(2*(XAVGC8.16 -XAVGC17.16) -(XAVG(XAVGC8.16,8) -XAVG(XAVGC17.16,17))) +.0937*(2*(XAVGC8.17 -XAVGC17.17) -(XAVG(XAVGC8.17,8) -XAVG(XAVGC17.17,17))) +.0669*(2*(XAVGC8.18 -XAVGC17.18) -(XAVG(XAVGC8.18,8) -XAVG(XAVGC17.18,17))) +.0478*(2*(XAVGC8.19 -XAVGC17.19) -(XAVG(XAVGC8.19,8) -XAVG(XAVGC17.19,17))) +.0341*(2*(XAVGC8.20 -XAVGC17.20) -(XAVG(XAVGC8.20,8) -XAVG(XAVGC17.20,17))) +.0244*(2*(XAVGC8.21 -XAVGC17.21) -(XAVG(XAVGC8.21,8) -XAVG(XAVGC17.21,17))) +.0174*(2*(XAVGC8.22 -XAVGC17.22) -(XAVG(XAVGC8.22,8) -XAVG(XAVGC17.22,17))) +.0124*(2*(XAVGC8.23 -XAVGC17.23) -(XAVG(XAVGC8.23,8) -XAVG(XAVGC17.23,17))) +.0089*(2*(XAVGC8.24 -XAVGC17.24) -(XAVG(XAVGC8.24,8) -XAVG(XAVGC17.24,17))) +.0063*(2*(XAVGC8.25 -XAVGC17.25) -(XAVG(XAVGC8.25,8) -XAVG(XAVGC17.25,17))) +.0045*(2*(XAVGC8.26 -XAVGC17.26) -(XAVG(XAVGC8.26,8) -XAVG(XAVGC17.26,17))) +.0032*(2*(XAVGC8.27 -XAVGC17.27) -(XAVG(XAVGC8.27,8) -XAVG(XAVGC17.27,17))) +.0023*(2*(XAVGC8.28 -XAVGC17.28) -(XAVG(XAVGC8.28,8) -XAVG(XAVGC17.28,17))) +.0017*(2*(XAVGC8.29 -XAVGC17.29) -(XAVG(XAVGC8.29,8) -XAVG(XAVGC17.29,17))))) - (.01*(28.57142*(2*(XAVGC8 -XAVGC17) -(XAVG(XAVGC8,8) -XAVG(XAVGC17,17))) +20.4082*(2*(XAVGC8.1 -XAVGC17.1) -(XAVG(XAVGC8.1,8) -XAVG(XAVGC17.1,17))) +14.5773*(2*(XAVGC8.2 -XAVGC17.2) -(XAVG(XAVGC8.2,8) -XAVG(XAVGC17.2,17))) +10.4123*(2*(XAVGC8.3 -XAVGC17.3) -(XAVG(XAVGC8.3,8) -XAVG(XAVGC17.3,17))) +7.4374*(2*(XAVGC8.4 -XAVGC17.4) -(XAVG(XAVGC8.4,8) -XAVG(XAVGC17.4,17))) +5.3124*(2*(XAVGC8.5 -XAVGC17.5) -(XAVG(XAVGC8.5,8) -XAVG(XAVGC17.5,17))) +3.7946*(2*(XAVGC8.6 -XAVGC17.6) -(XAVG(XAVGC8.6,8) -XAVG(XAVGC17.6,17))) +2.7104*(2*(XAVGC8.7 - XAVGC17.7) -(XAVG(XAVGC8.7,8) -XAVG(XAVGC17.7,17))) +1.9360*(2*(XAVGC8.8 -XAVGC17.8) -(XAVG(XAVGC8.8,8) -XAVG(XAVGC17.8,17))) +1.3829*(2*(XAVGC8.9 -XAVGC17.9) -(XAVG(XAVGC8.9,8) -XAVG(XAVGC17.9,17))) +.9878*(2*(XAVGC8.10 -XAVGC17.10) -(XAVG(XAVGC8.10,8) -XAVG(XAVGC17.10,17))) +.7055*(2*(XAVGC8.11 -XAVGC17.11) -(XAVG(XAVGC8.11,8) -XAVG(XAVGC17.11,17))) +.504*(2*(XAVGC8.12 -XAVGC17.12) -(XAVG(XAVGC8.12,8) -XAVG(XAVGC17.12,17))) +.36*(2*(XAVGC8.13 -XAVGC17.13) -(XAVG(XAVGC8.13,8) -XAVG(XAVGC17.13,17))) +.2571*(2*(XAVGC8.14 -XAVGC17.14) -(XAVG(XAVGC8.14,8) -XAVG(XAVGC17.14,17))) +.1837*(2*(XAVGC8.15 -XAVGC17.15) -(XAVG(XAVGC8.15,8) -XAVG(XAVGC17.15,17))) +.1312*(2*(XAVGC8.16 -XAVGC17.16) -(XAVG(XAVGC8.16,8) -XAVG(XAVGC17.16,17))) +.0937*(2*(XAVGC8.17 -XAVGC17.17) -(XAVG(XAVGC8.17,8) -XAVG(XAVGC17.17,17))) +.0669*(2*(XAVGC8.18 -XAVGC17.18) -(XAVG(XAVGC8.18,8) -XAVG(XAVGC17.18,17))) +.0478*(2*(XAVGC8.19 -XAVGC17.19) -(XAVG(XAVGC8.19,8) -XAVG(XAVGC17.19,17))) +.0341*(2*(XAVGC8.20 -XAVGC17.20) -(XAVG(XAVGC8.20,8) -XAVG(XAVGC17.20,17))) +.0244*(2*(XAVGC8.21 -XAVGC17.21) -(XAVG(XAVGC8.21,8) -XAVG(XAVGC17.21,17))) +.0174*(2*(XAVGC8.22 -XAVGC17.22) -(XAVG(XAVGC8.22,8) -XAVG(XAVGC17.22,17))) +.0124*(2*(XAVGC8.23 -XAVGC17.23) -(XAVG(XAVGC8.23,8) -XAVG(XAVGC17.23,17))) +.0089*(2*(XAVGC8.24 -XAVGC17.24) -(XAVG(XAVGC8.24,8) -XAVG(XAVGC17.24,17))) +.0063*(2*(XAVGC8.25 -XAVGC17.25) -(XAVG(XAVGC8.25,8) -XAVG(XAVGC17.25,17))) +.0045*(2*(XAVGC8.26 -XAVGC17.26) -(XAVG(XAVGC8.26,8) -XAVG(XAVGC17.26,17))) +.0032*(2*(XAVGC8.27 -XAVGC17.27) -(XAVG(XAVGC8.27,8) -XAVG(XAVGC17.27,17))) +.0023*(2*(XAVGC8.28 -XAVGC17.28) -(XAVG(XAVGC8.28,8) -XAVG(XAVGC17.28,17))) +.0017*(2*(XAVGC8.29 -XAVGC17.29) -(XAVG(XAVGC8.29,8) -XAVG(XAVGC17.29,17))))))

I think Bustermu was putting me to the test there with his last comment. I got to admit, both your math skills and his make me look like a kindergartner. At least everything seems to be O.K. The DEMA seems to do a better job in my opinion thus far, but I only compared it to a standard MACD 8,17,6 for a few stocks. In only one case I recollect it was slightly volatile, and, of course, I only tried the one period mentioned. I just wish I understood the math so I could try more periods! And one last comment, Bustermu, I was unaware that this method produced zero lag. From what I am seeing, this appears to be the case.

Thanks a bunch.
Stmjd74
Posted : Sunday, September 11, 2005 1:08:44 PM
Registered User
Joined: 12/18/2004
Posts: 180
I am still not sure if I am missing something here. Jim said that the trigger line was calculated as and EMA in Bruce's formula. I'm sure that it was calculated using DEMA in the long formula I posted, and it seems to match perfectly. Could one of you two respond and clarify this?

Thanks for all your help!
bustermu
Posted : Sunday, September 11, 2005 2:48:19 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
John,

You and Bruce agree because you both put an EMA6 on the Signal to get the Trigger. As I understand it, you are suppose to put a DEMA6 on the Signal to get the Trigger.

Your PCF is in the form:

Sig-(2*XAVG(Sig,6)-XAVG(Sig,6))

which is equivalent to:

Sig-XAVG(Sig,6)

but about twice as long.

The Histogram is suppose to be of the form:

Sig-(2*XAVG(Sig,6)-XAVG(XAVG(Sig,6),6))

Relax. Bruce can do it without any series expansion.

Thanks,
Jim Murphy
Stmjd74
Posted : Sunday, September 11, 2005 5:16:50 PM
Registered User
Joined: 12/18/2004
Posts: 180
Oh, yeah. I see that now Jim. Thanks. I used 2*EMA-EMA for the signal line component instead of 2*EMA-EMA(EMA). Oops (wouldn't have been practical anyway when it takes 10 minutes to view the next symbol from the time you hit the space bar).
bustermu
Posted : Sunday, September 11, 2005 6:35:06 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
John,

It may be too slow the way you are trying to do it, but it won't be the way Bruce is going to do it.

Thanks,
Jim Murphy
laphill
Posted : Sunday, September 11, 2005 9:59:11 PM
Registered User
Joined: 12/7/2004
Posts: 393
Gentlemen,is this the path to the holy grail ?
Craig_S
Posted : Sunday, September 11, 2005 10:50:49 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
The bigger question for you, laphill...

Do you believe there is such a thing as a "holy grail" for technical analysis?

- Craig
Here to Help!
Bruce_L
Posted : Monday, September 12, 2005 7:20:10 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Most of the stuff mentioned in my Saturday, September 10, 2005 8:19:59 AM still applies (hopefully that doesn't include the part about being incorrect). You will want to check Center Zero Line when plotting any of the formulas below as a Custom Indicator. The formulas plot on different scales, so the first two can't be compared visibly or combined as a Custom Indicator replacement for MACD. As a result, DEMA MACD plotted as a "Histogram" is probably the best visible version of the indicator (but will plot as a line).

DEMA MACD Line (8,17):
2 * XAVGC8 + XAVG(XAVGC17,17) - 2 * XAVGC17 - XAVG(XAVGC8,8)

DEMA MACD Trigger (8,17,6):
207945 / 5324 * XAVGC6 + 21 / 4 * XAVG(XAVGC8,8) + 96 / 121 * XAVG(XAVGC17,17) + 4905 / 484 * XAVG(XAVGC6,6) - 217 / 4 * XAVGC8 - 1312 / 1331 * XAVGC17

DEMA MACD Histogram (8,17,6):
225 / 4 * XAVGC8 + 25 / 121 * XAVG(XAVGC17,17) - 1350 / 1331 * XAVGC17 - 207945 / 5324 * XAVGC6 - 25 / 4 * XAVG(XAVGC8,8) - 4905 / 484 * XAVG(XAVGC6,6)

QUOTE (Stmjd74)
I just wish I understood the math so I could try more periods!

Assuming everything in the spreadsheet is working correctly, I should now be able to produce DEMA MACD formulas with different settings fairly quickly.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Stmjd74
Posted : Monday, September 12, 2005 2:24:24 PM
Registered User
Joined: 12/18/2004
Posts: 180
Thanks Bruce. And thanks for all the help with this, Jim M. I guess my quest is to eventually be able to do this in different time periods for myself...
Stmjd74
Posted : Monday, September 12, 2005 3:10:18 PM
Registered User
Joined: 12/18/2004
Posts: 180
I'm not sure, but I think that maybe you should drop the whole signal line thing for this method. It may work better on a different period. Anyway, thanks again those who helped me out here.
TomG18
Posted : Monday, September 12, 2005 7:09:02 PM
Registered User
Joined: 12/2/2004
Posts: 37
Would one of you fine gentlepersons kindly present a brief explanaton of what all this math is about? Why is DEMA, etc. better than any other technical tools? What are it's downsides/weaknesses v other indicators. Thanks! Again, nice job on the math!!
Bruce_L
Posted : Monday, September 12, 2005 7:19:34 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
As a trainer, I can't offer interpretation advice. Moving Averages lag price. The DEMA is designed to reduce this delay. The rest I have to leave to others to answer.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
laphill
Posted : Tuesday, September 13, 2005 2:15:17 AM
Registered User
Joined: 12/7/2004
Posts: 393
Craig S, I agree with your boss.
bustermu
Posted : Tuesday, September 13, 2005 3:59:00 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
Bruce,

I have checked your Trigger PCF and get the same rational coefficients. Perfect.

Excel does rational arithmatic or did you teach it?

Thanks,
Jim Murphy
Bruce_L
Posted : Tuesday, September 13, 2005 7:42:45 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (bustermu)
Excel does rational arithmatic or did you teach it?

Sadly both.

I spent a lot of time writing formulas somewhat longer than necessary before figuring out just yesterday the spreadsheet could accomplish much of this on its own if I just set the cell formatting appropriately. In this case:

+???????/???????;-???????/???????

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Stmjd74
Posted : Tuesday, September 13, 2005 9:38:23 AM
Registered User
Joined: 12/18/2004
Posts: 180
My apologies, Bruce. I didn't realize that it would involve so much time and effort. May have helped someone, though.
Bruce_L
Posted : Tuesday, September 13, 2005 9:41:49 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Stmjd74,
There's no reason to apologize. Not every experiment works out as expected and the trainers are here to help (besides, I found the exercise quite enjoyable)! Are you sure you don't want to try out some other DEMA MACD settings?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bustermu
Posted : Tuesday, September 13, 2005 11:19:53 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
The DEMA MACD(P,Q) Line and the EMA MACD(P,Q,R) Histogram for R = (P+Q)/2 are surprisingly close to overlaying one another. This makes the DEMA MACD essentially available through proper EMA MACD settings.

With the notation introduced above, we have for the DEMA MACD(P,Q) Line

DP-DQ = 2*(EP-EQ)-(EP^2-EQ^2)
= 2*(EP-EQ)-(EP+EQ)*(EP-EQ)
= 2*(EP-EQ-((EP+EQ)/2)*(EP-EQ))

If we let R = (P+Q)/2, then the Moving Averages ER and (EP+EQ)/2 have the same lag and nearly overlay one another.

The EMA MACD(P,Q,R) Histogram is

Hist = EP-EQ-ER*(EP-EQ)

Thus, with the approximation ER ~ (EP+EQ)/2 when R = (P+Q)/2, we have the approximation

DEMA MACD(P,Q) Line ~ 2*(EMA MACD(P,Q.R) Hist)

as claimed.

You can readily observe the approrimation, but there needs to be a proof.

Please note that EP*EQ is not the usual multiplication of two EMA's, it is the cascade of the two.

Thanks,
Jim Murphy

Bruce_L
Posted : Tuesday, September 13, 2005 11:32:09 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
bustermu,
I'd thought about pointing out the similarity between the EMA MACD Histogram (12,26,9) and the DEMA MACD (8,17) earlier, but hadn't gone any further and wouldn't have thought to take it to this level. Thanks!

Since the vast majority of the conversion in this topic has been PCFs, EasyScan and Custom Indicators related, I'm moving it there.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
JPL
Posted : Saturday, March 17, 2007 3:59:34 PM
Registered User
Joined: 12/22/2006
Posts: 2
[quote=Bruce_L]Most of the stuff mentioned in my Saturday, September 10, 2005 8:19:59 AM still applies (hopefully that doesn't include the part about being incorrect). You will want to check Center Zero Line when plotting any of the formulas below as a Custom Indicator. The formulas plot on different scales, so the first two can't be compared visibly or combined as a Custom Indicator replacement for MACD. As a result, DEMA MACD plotted as a &quot;Histogram&quot; is probably the best visible version of the indicator (but will plot as a line).

DEMA MACD Line (8,17):
2 * XAVGC8 + XAVG(XAVGC17,17) - 2 * XAVGC17 - XAVG(XAVGC8,8)

DEMA MACD Trigger (8,17,6):
207945 / 5324 * XAVGC6 + 21 / 4 * XAVG(XAVGC8,8) + 96 / 121 * XAVG(XAVGC17,17) + 4905 / 484 * XAVG(XAVGC6,6) - 217 / 4 * XAVGC8 - 1312 / 1331 * XAVGC17

DEMA MACD Histogram (8,17,6):
225 / 4 * XAVGC8 + 25 / 121 * XAVG(XAVGC17,17) - 1350 / 1331 * XAVGC17 - 207945 / 5324 * XAVGC6 - 25 / 4 * XAVG(XAVGC8,8) - 4905 / 484 * XAVG(XAVGC6,6)



Dear Math Wizards: Could one of you confirm the changes that would be required for a Trigger Line Formula with the parameters of (8,17,9) instead of the (8,17,6) shown above. I can guess but I just want to be sure. Thanks.
JPL
Posted : Saturday, March 17, 2007 5:05:32 PM
Registered User
Joined: 12/22/2006
Posts: 2
QUOTE (JPL)
[quote=Bruce_L]Most of the stuff mentioned in my Saturday, September 10, 2005 8:19:59 AM still applies (hopefully that doesn't include the part about being incorrect). You will want to check Center Zero Line when plotting any of the formulas below as a Custom Indicator. The formulas plot on different scales, so the first two can't be compared visibly or combined as a Custom Indicator replacement for MACD. As a result, DEMA MACD plotted as a &amp;quot;Histogram&amp;quot; is probably the best visible version of the indicator (but will plot as a line).

DEMA MACD Line (8,17):
2 * XAVGC8 + XAVG(XAVGC17,17) - 2 * XAVGC17 - XAVG(XAVGC8,8)

DEMA MACD Trigger (8,17,6):
207945 / 5324 * XAVGC6 + 21 / 4 * XAVG(XAVGC8,8) + 96 / 121 * XAVG(XAVGC17,17) + 4905 / 484 * XAVG(XAVGC6,6) - 217 / 4 * XAVGC8 - 1312 / 1331 * XAVGC17

DEMA MACD Histogram (8,17,6):
225 / 4 * XAVGC8 + 25 / 121 * XAVG(XAVGC17,17) - 1350 / 1331 * XAVGC17 - 207945 / 5324 * XAVGC6 - 25 / 4 * XAVG(XAVGC8,8) - 4905 / 484 * XAVG(XAVGC6,6)



Dear Math Wizards: Could one of you confirm the changes that would be required for a Trigger Line Formula with the parameters of (8,17,9) instead of the (8,17,6) shown above. I can guess but I just want to be sure. Thanks.


Please confirm the histogram change as well. Thanks
Bruce_L
Posted : Sunday, March 18, 2007 9:17:45 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
JPL,
Here's what I came up with:

DEMA MACD Line (8,17):
2 * XAVGC8 + XAVG(XAVGC17,17) - 2 * XAVGC17 - XAVG(XAVGC8,8)

DEMA MACD Trigger (8,17,9):
770 * XAVGC8 + 4 * XAVGC17 - 882 * XAVGC9 + 63 * XAVG(XAVGC8,8) + 45 * XAVG(XAVGC9,9)

DEMA MACD Histogram (8,17,9):
882 * XAVGC9 - 768 * XAVGC8 - 6 * XAVGC17 - 64 * XAVG(XAVGC8,8) + XAVG(XAVGC17,17) - 45 * XAVG(XAVGC9,9)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
sebastienh1
Posted : Wednesday, February 17, 2010 7:52:31 AM
Registered User
Joined: 7/1/2009
Posts: 7
Sorry to dig up an old topic, but I'm looking for the formula of the macd zero lag for stockfinder. I don't know if Telechart and stockfinder are using the same code, but it doesn't work for me. I don't even have the basics on realcode programming. Does anyone can post the formula "ready to paste" into stockfinder ?
Bruce_L
Posted : Wednesday, February 17, 2010 8:55:02 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
sebastien.h1,
You should be able to Open an attached Indicator directly into a running copy of StockFinder (and save it from within StockFinder if desired).

Attachments:
DEMA MACD.sfInd - 6 KB, downloaded 1,035 time(s).



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
sebastienh1
Posted : Wednesday, February 17, 2010 9:22:41 AM
Registered User
Joined: 7/1/2009
Posts: 7
It works perfectly well !!Thank you Bruce
Bruce_L
Posted : Wednesday, February 17, 2010 9:48:06 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
sebastien.h1,
You're welcome. Our pleasure.

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