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

Re: [EquisMetaStock Group] Weekly MACD histogram



PureBytes Links

Trading Reference Links

Hi Alan

> I have a question on your formula.  In some cases, you repeat the
> definition of a variable.  For example:
> I:=Fml("Calendar Week counter");
> I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
>
> Is this similar to usage in computer programming? For example,
> x:=x+1.  Here, the old value of "x" is being operated on to produce a
> new value.

Spot on. I find it is often simpler to set up a basic variable and then adjust (or modify) it a
couple of times than try and include all the logic in only one line. Each succeeding line starts
with the variable definition already create it and adds another logical component (or not) as
required.

You can also create an entirely new variable definition using a previously defined variable name.
The reason for doing this is ususally to get around the 20 var limit, and the new definition would
be created once the old definition was no longer required for the remaining part of the formula.

> Here are my first attempts to decipher your "Weekly MACD - Close":
> total confusion and disarray.
>
>
> G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);

The purpose of this variable is to identify if the chart is in daily or weekly periodicy. My
definition of a weekly chart is crude but reasonably effective - if 5 successive bars anywhere in
the chart are Friday's then consider the chart to be weekly periodicy, otherwise assume daily
periodicy.

By summing the number of successive Fridays in any 5 bars I know that a result of 5 means that five
contiguous bars are Friday. It would be extremely unusual for this to happen on a daily chart and
almost inevitable on a weekly chart.

Using Highest() means that I only need to see this value once to come to the conclusion that the
chart is weekly. Using LastValue() makes a logical TRUE (ONE) available for use whereever I want.
One of the places I use the is in ValueWhen(2-G,J,C) for example. What this says is if J is TRUE
(greater than or equal ONE) then look back to the previous value of CLOSE, but if G is TRUE then use
the current value of CLOSE.

Sorry that my description is hurried but hope this helps.

Roy

> Split into smaller pieces:
>
> a:=Sum(DayOfWeek()=F,5);
> b:=Highest(a);
> c:=LastValue(b=5)
>
> Explanation:
>
> a:=Sum(DayOfWeek()=F,5);
> --------------------------------------
> The value of F is input by the user. Assume F=5, so no trading on
> Saturday or Sunday.
> Assume that today is Monday (=1).
> Therefore:
> Today: [DayOfWeek()=5] is False, or 0
> Previous day, Friday (because F=5): [] is True, or 1
> Thursday: [] is False, or 0
> and so on.
>
> Therefore,
> a:= the sum for five periods, (0,1,0,0,0), which is 1
> It seems to me that the sum will always be "1", so already I must be
> losing the thread :-)
> If I plot this bit as an indicator, I get a horizontal line at Y=5
> going back to 1994.  This implies that the daily values are all "1"
> :-)
> --------------------------------------
> b:=Highest(a);
> --------------------------------------
> b is the highest ever value for "a", starting from the first day
> loaded in the chart until today.
> By my analysis (paralysis?), this can only ever be "1".  When plotted
> in Metastock, it's "5".
> --------------------------------------
> c:=LastValue(b=5)
> --------------------------------------
> If the last value of the data array "b" is equal to "5", then c:=1
> (True).
> Otherwise, c:=0 (False)
>
>
>
> A few hints would be appreciated.
>
> Regards,
> Alan
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx>
> wrote:
> > Hi Alan
> >
> > > I made my post at 2233 SHT (Scottish Highlands Time) and your
> reply
> > > was at 2350.
> >
> > As you can see I don't always reply that quickly, and sometimes I
> forget to reply at all.
> >
> > > At that rate of output (five A4 pages), I estimate that
> > > your book will take about four days to write.  That's a lot less
> than
> > > the several weeks it will take me to work through your response
> point
> > > by point.
> >
> > If only writing a book were that easy :-)
> >
> > > I'm amazed at your offer to an obvious know-nothing to "walk me
> > > through" something that I described as "fiendishly complicated".
> >
> > It's not a problem for me.
> >
> > > On the subject of probabilities, no statistician would believe
> that,
> > > out of the world's total population of 7,000 (according to Fred
> > > Flintstone -it's probably double that by now), I find myself
> casually
> > > boasting to the author about a "fiendishly complicated" formula.
> If
> > > the newsgroup moderators had any human feelings at all, they would
> > > have intercepted your post to prevent the affront to my dignity.
> >
> > Your opinion is probably shared by many, but you just happened to
> be the one that put it in writing.
> > No offence taken.
> >
> > What you need to watch for is when you accidentally post a private
> reply to a large group. Now that
> > can be embarrassing.
> >
> > Regards
> >
> > Roy
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->

 
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/