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

Re: [Metastockusers] Re: Multiple timeframes



PureBytes Links

Trading Reference Links

Pring

Sorry, I missed your question until now so did not respond earlier. At first
glance I think kut2k2 may have covered the essential points. If not then I
will try and answer any further questions you may have.

I've given up attempting to comment most code - the usual lack of interest
means to add comment is just an additional waste of time. I'm always happy
to discuss or explain to anyone that is interested.

kut2k2

Thank you for your suggestions. I'll look at adding them to my indicator.

I don't deliberately write obscure code, but neither do I deliberately make
it crystal clear. In my experience the best lessons are those that I have to
work for. The occasional gem that I drop into code is there for anyone that
wants to delve a little deeper, and will remain hidden from those that are
too lazy (or whatever) to work at or follow through on. That's not my
concern or problem. I'm willing to expand or explain to anyone that has a
legitimate question, but my first response is rarely going to be a total
packaged solution with all the answers.

Thanks again for the work you put into creating comments for my code.

Roy

----- Original Message ----- 
From: "kut2k2" <kut2k2@xxxxxxxxx>
To: <Metastockusers@xxxxxxxxxxxxxxx>
Sent: Sunday, May 25, 2003 3:23 PM
Subject: [Metastockusers] Re: Multiple timeframes


> --- In Metastockusers@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx>
> wrote:
> > Pring
> >
> > > I don't know if it is me but I'm sure we all have our
> > > own ways of writing formulas and I find it difficult
> > > to follow what you have below.  I do write quite a
> > > number of formulas, experts, etc. so I understand the
> > > basic ideas.
> >
> > Don't worry. Often I can't understand my own stuff when I go back to
> it
> > either : (
> >
> > I don't use long variable names because when repeated often they
> take up
> > more room than I can afford. Comments ditto.
> >
> > > Would you mind inserting some comments explaining what
> > > you are doing after each line of code?  For example, I
> > > know the DayOfWeek is looking for a close on Friday
> > > but what about the rest of the lines?
> > >
> > > That would be greatly appreciated!
> >
> > Will do. Forgive me for not addressing the issues in the timeframe
> of your
> > choice but I don't own MS Pro and so prefer to post only that code
> that I
> > can actually test as OK.
> >
> >   {Weekly Frame CLOSE}
> > W1:=DayOfWeek()=5;
> >   {is this bar a Friday?}
> > W2:=Alert(W1,2);
> >   {extend Friday bar across next trade day}
> > W3:=DayOfWeek()<Ref(DayOfWeek(),-1);
> >   {Is this the day after the last day of the week?}
> > We:=If(W1,1,If(W2=0 AND W3,2,0));
> >   {end of week - if Friday then assign a value of one, if first day
> of week
> > following a missing Friday then assign a value of two}
> > Wcl:=ValueWhen(1,We>0,If(We=1,C,Ref(C,-1)));
> >   {weeks CLOSE - if end of week was a Friday then use CLOSE, if end
> of week
> > was not a friday then use CLOSE for the previous bar}
> > Wcl;
>
> Hi, Roy
>
> I also had to struggle somewhat to follow your program. I wonder if
> the following modifications might help the next time you post it for
> someone? If so, feel free to use them. :-)
>
> {Weekly Frame CLOSE}
> Fri := DayOfWeek()=5;
> NoHoliday := Alert(Friday, 2);
> Mon := DayOfWeek()=1;
> EoW := If(Fri, 1, If(NoHoliday=0 AND Mon, 2, 0));
> {end of week - if Friday then assign a value of one; if Monday
> following a holiday Friday then assign a value of two}
> Wcl := ValueWhen(1, EoW>0, If(EoW=1, C, Ref(C,-1)));
> {weeks CLOSE - if end of week was Friday then use CLOSE, if end
> of week was not Friday then use CLOSE for Thursday}
> Wcl;
>
> kut2k2
>
> >    {Weekly Frame EMA}
> > Pds:=Input("Weekly periods",3,99,34);
> >   {ema periods}
> > Pct:=2/(Pds+1);
> >   {percentage calculation to determine how much of current CLOSE to
> add to
> > previos value of ema, and how much to discard. This information is
> contained
> > in the manual}
> > W1:=DayOfWeek()=5;
> > W2:=Alert(W1,2);
> > W3:=DayOfWeek()<Ref(DayOfWeek(),-1);
> > We:=If(W1,1,If(W2=0 AND W3,2,0));
> > Wcl:=ValueWhen(1,We>0,If(We=1,C,Ref(C,-1)));
> >   {all same as prevoius formula above}
> > {Ema:=If(We>0,PREV + Wcl*Pct,PREV);} {per MS manual}
> >   {I think this line is faulty - ignore it anyway}
> > Ema:=If(We>0,If(Cum(We>0)=1,C,PREV)*(1-Pct) +Wcl*Pct,PREV);
> {modified}
> >   {each end of week this var will be updated with the appropriate
> percentage
> > of the weekly CLOSE. There is also a "seeding" piece of code to
> start the
> > var off with the CLOSE at the end if the first week. See my earlier
> post
> > about moving averages to get the equivalent daily EMA variables.}
> > Ema;  {output}
> >
> > The reason for assigning a value of either one or two to the end of
> week bar
> > is so that I know whether it was a regular Friday end of week or a
> missing
> > Friday end of week. For the missing Friday event I don't know about
> it until
> > the following bar, and then I need to back up one bar to get the
> correct
> > CLOSE (in the 'Wcl' variable).
> >
> > Roy
>
>
>
> To unsubscribe from this group, send an email to:
> Metastockusers-unsubscribe@xxxxxxxxxxx
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>



To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

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