|
|
MACD question
Last post 05-09-2006, 18:15 by StorkBite. 14 replies.
-
-
05-04-2006, 13:28 |
-
wabbit
-
-

-
Joined on 10-28-2004
-
Perth, Western Australia
-
Posts 2,042
-
-
|
The value that you are adjusting is the signal line periods i.e. the moving average period. The difference is still between the 0.075 and 0.15 exponential moving averages.
You can make your own MACD by following the instructions/code in the "Creating Your Own Indicators" section of the manual.
You wil not be able to exactly replicate the built in MACD, but the differences are, for the most part, insignificant.
If you get stuck, just ask for help.
wabbit :D
"The question of whether a computer can think is no more interesting than the question of whether a submarine can swim." Edsgar W. Dijkstra MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK For custom MetaStock programming : http://www.wabbit.com.au My SkyPE status :  My SkyPE account : wabbit.com.au
|
|
-
05-04-2006, 13:34 |
-
hayseed
-
-
-
Joined on 03-07-2005
-
-
Posts 1,354
-
-
|
hey peter.... that changes the the signal/trigger line only.... perhaps you can adapt the code below to match your needs.....h
macd style with inputs { edited to reflect jose's more accurate numbers and investorretired's histogram suggestions}
-------------------------------------------
ma1:=Input("short moving average",1,100,12.3);
ma2:=Input("long moving average ",1,200,25.7);
ma3:=Input("signal moving average",1,200,9);
0;
a:=Mov(C ,ma1 ,E )- Mov(C ,ma2 ,E );
b:=Mov(a,ma3,E);
a;
b;
a-b
----------------------------------------------
|
|
-
05-04-2006, 14:09 |
-
-
05-08-2006, 12:05 |
-
05-08-2006, 18:15 |
|
|
Hayseed:
Changing a MACD to a histogram in MS will not get the desired results. This will give a histogram of the MACD or MACD signal line.
I believe the MACD histogram is defined as the difference between the MACD line and the MACD signal line and then presented as a histogram. This makes the centerline crossovers and divergences easily identifiable.
By changing your formula slightly (Listed Below “a;b” to “a-b”) and by then changing the line style to histogram will get the desired results. You may also want to add a horizontal line at zero.
macd style with inputs
--------------------------------------------
ma1:=Input("short moving average",1,100,12);
ma2:=Input("long moving average ",1,200,26);
ma3:=Input("signal moving average",1,200,9);
a:=Mov(C ,ma1 ,E )- Mov(C ,ma2 ,E );
b:=Mov(a,ma3,E);
a-b
InvestorRetired
|
|
-
05-08-2006, 19:13 |
-
05-08-2006, 22:43 |
-
henry1224
-
-

-
Joined on 10-29-2004
-
Glastonbury, CT
-
Posts 933
-
-
|
using decimals in Moving averages?
Metastock will allow you to use decimals in a moving average, but it will calculate the Moving average as if it were whole numbers.
here is a test
Macd 1 using decimals in the input
ma1:=Input("short moving average",1,100,12.3);
ma2:=Input("long moving average ",1,200,25.7);
ma3:=Input("signal moving average",1,200,9);
0;
a:=Mov(C ,ma1 ,E )- Mov(C ,ma2 ,E );
b:=Mov(a,ma3,E);
a;
b;
a-b
Macd 2 using only whole numbers
ma1:=Input("short moving average",1,100,12);
ma2:=Input("long moving average ",1,200,26);
ma3:=Input("signal moving average",1,200,9);
0;
a:=Mov(C ,ma1 ,E )- Mov(C ,ma2 ,E );
b:=Mov(a,ma3,E);
a;
b;
a-b
plot them into a chart and you will see that the numbers are the same
|
|
-
05-08-2006, 23:00 |
-
Jose
-
-

-
Joined on 01-20-2005
-
Koh Pha-Ngan, Earth
-
Posts 1,087
-
-
|
Re: using decimals in Moving averages?
Henry, the plots are clearly different.
Try plotting both indicators in the same window.
jose '-)
MetaStockTools.com
|
|
-
05-08-2006, 23:48 |
-
mstt
-
-

-
Joined on 07-26-2005
-
-
Posts 408
-
-
|
Re: using decimals in Moving averages?
Hi Jose
The plots are clearly different because one MA is using a whole number of 25 and the other is using a whole number of 26, not because MS is using the fractional component of the "periods" parameter.
Regards
Roy
MetaStock Tips & Tools
|
|
-
05-09-2006, 0:46 |
-
henry1224
-
-

-
Joined on 10-29-2004
-
Glastonbury, CT
-
Posts 933
-
-
|
Decimals in Moving Averages
take a look at this post
http://forum.equis.com/viewtopic.php?t=103&highlight=
|
|
-
05-09-2006, 1:04 |
-
Jose
-
-

-
Joined on 01-20-2005
-
Koh Pha-Ngan, Earth
-
Posts 1,087
-
-
|
Re: Decimals in Moving Averages
Hmmm... I guess that MetaStock's standard MA functions truncate inputs to integer values.
This works:
Code:
ma1:=Input("short moving average",1,100,12.3);
ma2:=Input("long moving average ",1,200,25.7);
ma3:=Input("signal moving average",1,200,9);
Ema1:=C*2/(ma1+1)+PREV*(1-2/(ma1+1));
Ema2:=C*2/(ma2+1)+PREV*(1-2/(ma2+1));
a:=Ema1-Ema2;
b:=Mov(a,ma3,E);
a;b;a-b
jose '-)
MetaStockTools.com
|
|
-
05-09-2006, 4:29 |
-
Capablanca
-
-
-
Joined on 10-25-2005
-
-
Posts 7
-
-
|
Re: Decimals in Moving Averages
I did not read the posts too thoroughly but in case it is relevant I think maybe what you are looking for is the PPO indicator or percentage price oscillator or simply price oscillator. It's basically a slightly more flexible version of the MACD although it still has limitations. Syntax: OscP(periods,periods,ma_method,diff_method).
|
|
-
05-09-2006, 18:15 |
|
|