From: ruagoodp <almutwinter[at]gmx.de>
To: Metastockusers[at]yahoogroups.com <Metastockusers[at]yahoogroups.com>
Date: Sunday, May 22, 2005, 12:31:37 PM
Subject: [Metastockusers] Weekly Indicator needed
Hi Roy,
Could this daily formula be converted into a weekly formula?
Hope you can help...
Bsetup:=Sum(C<Ref(C,-4),9)=9 AND
Ref(C,-9) >= Ref(C,-13);
BCD:=HighestSince(1,Peak(1,Bsetup,.001),(C<=Ref(L,-2)) + PREV);
BUY:=BCD-ValueWhen(1,Bsetup,BCD)=13 AND
Ref(BCD-ValueWhen(1,Bsetup,BCD)=13,-1)<>1;
buy
Norman
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Roy Larsen <rlarsen[at]man.quik.co.nz>
To: Metastockusers[at]yahoogroups.com <Metastockusers[at]yahoogroups.com>
Date: Monday, May 23, 2005, 12:44:08 AM
Subject: [Metastockusers] Weekly Indicator needed
Hi Norman
Try this. I'm not sure that I've treated the Peak() function correctly, bit it appears to just be
operating as an Init or IsDefined() function. I've only tested it on one chart and the 6 hits all
tally. Hope this is of some help. The weekly timing code could be made much simpler using Peak()
with DayofWeek() but the timing could be less accurate in the event of missing data bars.
This formula need "Calendar Week Counter" indicator.
|
Weekly Timing Code
{2005 Roy Larsen, www.metastocktips.co.nz}
{for use on daily charts with Jose Silva's "Calendar Week counter"}
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,0);
{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:=ValueWhen(2,1,A);
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);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Bsetup:=Cum((J>0)*(K<ValueWhen(5,J,K)));
Bsetup:=(Bsetup-ValueWhen(10,J>0,Bsetup))=9 AND
ValueWhen(10,J,K)>=ValueWhen(14,J>0,K);
BCD:=HighestSince(1,Peak(1,Bsetup,.001),
(K<=ValueWhen(3,J,Lw))+ValueWhen(1,J,PREV));
Buy:=BCD-ValueWhen(1,ValueWhen(1,J,Bsetup),BCD)=13;
Buy AND ValueWhen(2,J,Buy)=0;
|