Ok Graham and Mike - I just got a note from my friend saying I'm not
interpreting one of the rules correctly - the correct rule is:

The distance from the 10 day ma is the largest since the equity began
trading below the 10d ma (rather than largest it has been in the last
10 days).

So I can't use the sum command in this case because it requires a
period - could I count the period using code like this?

IIf(C<MAshort,Daysbelow = Daysbelow +1,Daysbelow);

Thoughts appreciated.

--- In [email protected], "droskill" <[EMAIL PROTECTED]> wrote:
>
> That looks like it - appreciate the help as always Graham - I hadn't
> thought of using sum in that way, and I now realize I need to look one
> day behind 
to make it work.
> 
> --- In [email protected], Graham <kavemanperth@> wrote:
> >
> > hopefully understood what you wanted
> > 
> > MAshort = MA(C,10);
> > MAdiff = MAshort - C;
> > MAlong = MA(C,200);
> > 
> > Buy = Sum(C<MAshort,10)==10 AND C > MAlong  AND L<ref(LLV(L,9),-1) AND
> > MAdiff>ref(HHV(MAdiff,9),-1);
> > Sell = C > MA(C,5);
> > 
> > -- 
> > Cheers
> > Graham Kav
> > AFL Writing Service
> > http://www.aflwriting.com
> > 
> > 
> > 2008/5/11 droskill <droskill@>:
> > > Guys,
> > >
> > > For some reason I'm having trouble translating the following rules
> > > into a system:
> > >
> > > 1)It has closed below its 10-day moving average for at least 10
days.
> > > 2) It is above its 200-day moving average. 3) It made its lowest low
> > > of the recent selloff today. 4) It closed stretched further
below its
> > > 10-day moving average than it has on any day of the recent selloff.
> > >
> > > Here's some of the code I have - but I think my approach is
completely
> > > wrong:
> > >
> > >
> > > MAdiff = C - MA(10,C);
> > > MAlong = MA(200,C);
> > >
> > > MAdays = Ref(C,-10) < Ref(MA(C,10),-10) AND Ref(C,-9) <
> > > Ref(MA(C,10),-9) AND Ref(C,-8) < Ref(MA(C,10),-8) AND Ref(C,-7) <
> > > Ref(MA(C,10),-7) AND Ref(C,-6) < Ref(MA(C,10),-6) AND Ref(C,-5) <
> > > Ref(MA(C,10),-5) AND Ref(C,-4) < Ref(MA(C,10),-4) AND Ref(C,-3) <
> > > Ref(MA(C,10),-3) AND Ref(C,-2) < Ref(MA(C,10),-2) AND Ref(C,-1) <
> > > Ref(MA(C,10),-1) AND C < MA(C,10);
> > >
> > > Buy = MAdays AND LLV(C,10) AND C > MAlong AND HHV(MAdiff,10);
> > > Sell = C > MA(C,5);
> >
>


Reply via email to