Hi there,
It seems to be that you want something like this:
stp:=12; {periods of the short-term ema}
ltp:=26; {periods of the long-term ema}
slp:=9; {periods of the MACD's signal line}
g:=3; {periods of consecutive higher values of the MACD's Histogram}
r:=3; {periods of consecutive lower values of the MACD's Histogram}
md:=mov(c,stp, e)-mov(c, ltp,e); {This is MACD}
mmd:=mov(md, slp,e); {MACD's singal line}
mdh:=md-mmd; {MACD's Histogram}
rmd:=roc(mdh, 1,$); {Roc of MACD's Histogram}
buy:=rmd>0 and barssince(ref( rmd>0,-1) )>=r; {We buy when we have
MACD's Histogram turning up plus there have been r-bars of MACD
Histogram consecutive lower values}
sell:=rmd<0 and barssince(ref( rmd<0,-1) )>=g; {we sell when we have
MACD's Histogram turning down plus there have been g-bars of MACD's
Histogram consecutive higher values)
Please note, that a) I don't have
metaStock on this pc, so I didn't
actually check the validity of the code and b) I'm not quite sure that
this is what is described in the link that was given.
Regards,
mc
--- In equismetastock@ yahoogroups. com, Alvin Yu <alvinyu2005@ ...> wrote:
>
> Hi Preston
>    My "not tally" mean " the number of green bars or red bars
are not the same as for the 2 charts " Example as follow:
>
>     1st to 10th bars (from Right) are all RED in Chartnexus
but it shows 4 Green & 6 "Red" in Metastock
> Â Â Â
> Â Â Â Â It seems that they are some comparison on the price data
between as the trigger is formulated when the
barschanged from red
to green & vise versa . The Chartnexus web shows some info on MACD
Histogram cycle but may not be detail enough .
> Â Â Â
http://www.chartnex us.com/learning/ manual/add- ons/node26. html#SECTION0041 1600000000000000 0
>
>    Hope It is not too troubling u to help me on this formula
>
> rgds
>
>
>
>
> ____________ _________ _________ __
> From: pumrysh <no_reply@xxxxxxxxxx s.com>
> To: equismetastock@
yahoogroups. com
> Sent: Thursday, 25 December 2008 2:19:44
> Subject: [EquisMetaStock Group] Re: MACD Histogram Cycle and Trigger
with 4 Green 1 Red or 4 Red 1 Green
>
>
> Alvin,
>
> What I gave you will work just like the pic.
>
> In order to get the style and colors you want you must right click
> on the indicator and change to the color and style that you want.
> This is covered in the users manual as well.
>
> Preston
>
> --- In equismetastock@ yahoogroups. com, Alvin Yu <alvinyu2005@ ....>
> wrote:
> >
> > Hi Preston
> > � � � Sorry I did not get this clear enough .My actual
needs as
> follow:
> >
> > � MACD Histogram (MACDH) to show the following:
> >
> > 1. When MACDH > 0
AND MACDH(t) > MACDH(t-1), output on the
> histogram is GREEN in colour.
> > 2. When MACDH > 0 AND MACDH(t) < MACDH(t-1), output on the
> histogram is RED in colour.
> > 3. When MACDH < 0 AND MACDH(t) < MACDH(t-1), output on the
> histogram is RED in colour.
> > 4. When MACDH < 0 AND MACDH(t) > MACDH(t-1), output on the
> histogram is GREEN in colour.
> >
> > Note: (t) denotes the most recent MACDH value, (t-1) denotes the
> value of MACDH one period before
> >
> > I saw this in the following web site� but I could not� find the
> solution:
> > http://forum. vtsystems. com/index. php?
> s=88fe854d789faa450 28153615fba14ed& showtopic= 9256&pid= 40576&st=
0&#ent
> ry40576
> >
>
> Appreciate if u can help on this .
> >
> > Merry Christmas and Happy New Year
> >
> > Ã�Â
> >
> >
> >
> > ____________ _________ _________ __
> > From: pumrysh <no_reply@xxxxxxxxx p s.com>
> > To: equismetastock@ yahoogroups. com
> > Sent: Thursday, 18 December 2008 11:27:22
> > Subject: [EquisMetaStock Group] Re: MACD Histogram Cycle and
> Trigger with 4 Green 1 Red or 4 Red 1 Green
> >
> >
> > Alvin,
> >
> > At the group site you can search old messages by using key words
> such
> > as MACD RED GREEN. I did and came up with:
> >
> > A:=MACD();
> > B:=Mov(MACD( ),5,E);
> > A;B;
> >
> > {RedGreen MACD Histogram}
> > X:= MACD();
> > Green:=If(X> Ref(X,-1)
,X,0);
> > Red:=If(X<Ref( X,-1),X,0) ;
> > Green; Red;
> >
> > The neat thing about doing a search in this way is that it goes
> all the
> > way back to 1999 when this group first started...literally tons of
> > indictors since then.
> >
> > Preston
> >
> > --- In equismetastock@ yahoogroups. com, "alvinyu2005"
> <alvinyu2005@ ...>
> > wrote:
> > >
> > > Hi
> > > Can any adv if Metastock has an std program for this MACD that
> > > show :
> > > 1) Red & Green colour bars instead of one single colour ? (Note:
> > Green
> > > bars show the price is closed with higher low ) Similar to the
> one
> > > shown in Amibroker in
> > > http://www.amibroke
r.org/userkb/ 2007/10/19/ macd-histograms-
> v1/
> > >
> > > 2) How should I write a programme that can screen stocks that
> satisfy
> > > continuous 4 Grren then next is 1 Red and/or 4 continuous 4 Red
> &
> > > follow with 1 green ?
> > >
> > > rgds
> > >
> >
> >
> >
> >
> > Happy Holidays from Yahoo! Messenger. Spread holiday cheers
> to your friends and loved ones today! Get started at
> http://emoticaroler s.com/
> >
>
> __.._,_.___
> Messages in this topic (4) Reply (via web post) | Start a new topic
> Messages | Files | Photos | Database | Polls
> MARKETPLACE
>
> ____________ _________ _________ __
> From kitchen basics to easy recipes - join the Group
from Kraft Foods
>
> Change settings via the Web (Yahoo! ID required)
> Change settings via email: Switch delivery to Daily Digest | Switch
format to Traditional
> Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
> Recent Activity
> * Â 8
> New MembersVisit Your Group
> Yahoo! News
> Get it all here
> Breaking news to
> entertainment news
> Yahoo! Finance
> It's Now Personal
> Guides, news,
> advice & more.
> Need traffic?
> Drive customers
> With search ads
> on Yahoo!
> .
>
>
>
> Yahoo! Toolbar is now powered with Search Assist.Download it now!
> http://sg..toolbar. yahoo.com/
>