[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Weekly MACD histogram



PureBytes Links

Trading Reference Links

While the "battle of the titans" is continuing in the background, 
here's my progress on the Weekly MACD.  

It's an attempt to emulate the "First Screen" in Elder's "Triple 
Screen" system.  The plot combines the two plots shown on page 130 
and 238 of "Trading for a Living".

Since this is my first formula posted here (actually 99.983% belongs 
to Roy/Jose - I just added the semicolon at the end), I'd be grateful 
for some comments. 

The MACD should be plotted as a dashed line, the signal as a full 
line, the histogram as a histogram, and the buy/sell triggers as a 
line.

I can think of some obvious refinements, but I don't want to try 
these until the commentators say that everything is fine so far.  
Refinements are:

1) Filter out buy and sell triggers that are too close to the 
histogram centreline.
1) Plot only the first trigger in any contiguous series of similar 
triggers. Ignore subsequent similar triggers until a trigger of the 
opposite type has fired.  This produces a plot of alternate buy and 
sell triggers :-)

Regards,
Alan

----------------------------------------------------

{Weekly MACD - Close}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
  {for use on daily charts with
   Jose Silva's "Calendar Week counter"}
N:=Input("Weekly MACD Signal Periods",1,19,9);
F:=Input("End of Week,  5=Friday  6=Saturday  7=Sunday",5,7,5);
Q:=Input("Display Mode,  0=Static  1=Dynamic  2=Test",0,2,2);
  {0=Display, update on Friday when possible}
  {1=Display, update on each new bar}
  {2=Backtest, update on first bar of new week}
G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);
I:=Fml("Calendar Week counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (DayOfWeek()=F AND I=0);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J); {corrected by Roy, 3 Apr 04}
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
X:=0.15; Y:=0.075; N:=2/(N+1);
X:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);
Y:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
R:=X-Y;
Z:=If(Cum(J>0)=1,R,ValueWhen(1,J,PREV)*(1-N)+R*N);
R; {MACD}
Z; {Signal} {end of Roy's stuff}
Hist:=(R-Z); {Histogram}
Hist;
Buy:=ROC(Hist,1,POINTS)>0 AND Hist<0;
Sell:=ROC(Hist,1,POINTS)<0 AND Hist>0;
If(Buy,1,0);
If(Sell,-1,0);
---------------------------------------------

--- In equismetastock@xxxxxxxxxxxxxxx, "Alan Davidson" 
<alan_davidson22@xxxx> wrote:
> Hi Bill,
> 
> I know even less about the MACD histogram than you do.  However, I 
> think you can do this:
> 
> 1)  Add the following as the last line of Roy/Jose's formula 
(below):
> 
> R-Z; {Histogram}
> 
> 2)  Insert the indicator on your chart.
> 
> 3)  Look for the line that is very different from the other two 
> lines.  This is the histogram.
> 
> 4)  Select this line.
> 
> 5)  At the lower left of your screen, select the line type as the 
> wavy vertical bars. (On my MetaStock, it's just 
below "Invisible".)  
> This is a histogram.
> 
> 6)  The buy signal is when the histogram slopes up from below the 
> centre line.  The sell signal is when the histogram slopes down 
from 
> above its centre line.
> 
> In a formula (I'm just learning about formulas), presumably you 
would 
> say that when (R-Z) reaches its maximum positive value, the 
histogram 
> starts to slope up.  When (R-Z) reaches its max negative value, the 
> hist starts to slope down.
> 
> I hope this gives you something to think about, but I'd advise you 
to 
> wait for a response from Roy or Jose before you start anything 
> serious.
> 
> Regards,
> Alan
> 
> 
> - In equismetastock@xxxxxxxxxxxxxxx, "Bill Saxon" <vondell@xxxx> 
> wrote:
> > Thanks Roy and Jose.   What great websites.  I pasted the 
formulae 
> in and it works great.
> > 
> > There is a mathematical formula that gives the slope of an 
> indicator, i.e. is a MACD line going basically up or down?  I have 
> seen reference to a slope of a regression line (if this is the same 
> thing) but nothing that could be applied to any indicator. I guess 
it 
> would use a P Array expression.
> > 
> > Thanks again.
> > 
> > Bill  
> >   ----- Original Message ----- 
> >   From: Roy Larsen 
> >   To: equismetastock@xxxxxxxxxxxxxxx 
> >   Sent: Friday, April 02, 2004 4:06 PM
> >   Subject: Re: [EquisMetaStock Group] Weekly MACD histogram
> > 
> > 
> >   Bill
> > 
> >   ----- Original Message ----- 
> >   From: "Jose" <josesilva22@xxxx>
> >   To: <equismetastock@xxxxxxxxxxxxxxx>
> >   Sent: Saturday, April 03, 2004 7:27 AM
> >   Subject: Re: [EquisMetaStock Group] Weekly MACD histogram
> > 
> > 
> >   >
> >   > Bill, just simply go here:
> >   > http://users.bigpond.com/prominex/pegasus.htm#roy
> >   >
> >   > Roy has gone through a lot of trouble to create accurate 
weekly
> >   > indicators for daily charts.  Forget the complexity, and just 
> copy and
> >   > paste the formulae into MetaStock.
> >   >
> >   > jose '-)
> > 
> > 
> >   For a more basic version try this. It still uses 
Jose's "Calendar 
> Week counter" for the greatest
> >   accuracy with any data gaps. Check it's accuracy against the 
> canned MACD() indicator on any weekly
> >   periodicy chart.
> > 
> >   Roy
> > 
> >     {Weekly MACD - Close Basic}
> >     {© 2004 Roy Larsen, rlarsen@xxxx}
> >     {for use on daily charts with
> >      Jose Silva's "Calendar Week counter"}
> >   N:=Input("Daily MACD Signal Periods",1,19,9);
> >   G:=LastValue(Highest(Sum(DayOfWeek()=
> >      ValueWhen(2,1,DayOfWeek()),5))=5);
> >   J:=Fml("Calendar Week counter");
> >   J:=Abs(J-ValueWhen(2-G,1,J)); J:=G OR J;
> >   K:=ValueWhen(1,J,ValueWhen(2-G,1,C));
> >   X:=0.15; Y:=0.075; N:=2/(N+1);
> >   X:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);
> >   Y:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
> >   R:=X-Y;
> >   Z:=If(Cum(J>0)=1,R,ValueWhen(1,J,PREV)*(1-N)+R*N);
> >   R; {MACD}
> >   Z; {Signal}
> > 
> > 
> > 
> > 
> > ------------------------------------------------------------------
--
> ----------
> >   Yahoo! Groups Links
> > 
> >     a.. To visit your group on the web, go to:
> >     http://groups.yahoo.com/group/equismetastock/
> >       
> >     b.. To unsubscribe from this group, send an email to:
> >     equismetastock-unsubscribe@xxxxxxxxxxxxxxx
> >       
> >     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of 
> Service.



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
     equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/