Alvin,
Here's the buy and sell formula.
Give it a try and let me know if its what you need.
Preston
g:=3; {periods of consecutive higher MACD's}
{RedGreen MACD Histogram}
X:= MACD();
Green:=If(X> Ref(X,-1) ,X,0);
Red:=If(X<Ref( X,-1),X,0) ;
buy:= BarsSince(green= 0)=g;
buy;
r:=3; {periods of consecutive lower MACD's}
{RedGreen MACD Histogram}
X:= MACD();
Green:=If(X> Ref(X,-1) ,X,0);
Red:=If(X<Ref( X,-1),X,0) ;
sell:= BarsSince(red= 0)=r;
sell;