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

Re: [Metastockusers] Re: WEEKLY INDICATOR



PureBytes Links

Trading Reference Links

Hi Norman
 
I'll take a look.
 
Here's a suggestion for you. Check each original variable in turn against the weekly equivalent. You might need to comment out the current plot so that you only have one plot from each indicator at any one time. Use a weekly chart for this exercise - the weekly indicator should plot exactly the same as the standard indicator.
 
Kind regards
 
Roy
 
----- Original Message -----
From: ruagoodp
Sent: Wednesday, June 01, 2005 3:53 AM
Subject: [Metastockusers] Re: WEEKLY INDICATOR

OK Roy,

I have gone thru the formula many times and as far as I can see I have
done everything correctly. I substituted the E for a U but the daily
plot and weekly plot don't fit.

Am I missing something obvious?

Cheers

Norman
>  
>
> Hi Roy,
>
> I have finished setting up this daily   indicator
>
> x1:=If(Ref(H,-2),<   ,Ref(C,-7),
> If(Ref(H,-2),<,Ref(C,-8),
> If(H,<,Ref(L,-5),
> If(H,<,Ref(L,-   6),0,1),1),1),1);
> x2:=If(Ref(L,-2),>   ,Ref(C,-7),
> If(Ref(L,-2),>,Ref(C,-8),
> If(L,>,Ref(H,-5),
> If(L,>,Ref(H,-   6),0,1),1),1),1);
> SubValues:=(x1) * (x2) * (H-Ref(H,-2) ) +((x1) * (x2) * 
(L-Ref(L,-2)) );
> AbsDailyVal:=(Abs(H-Ref(H,-2)) +   Abs(L-Ref(L,-2)));
> Sum((SubValues),8) /   Sum((AbsDailyVal),8)
>
>
>
> into a weekly indicator:  
>
>
> 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,1);
> {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);
> J:=If(G,1,If(Q=2 OR   Cum(J)<=1,M*2,J));
> Hw:=HighestSince(1,M,H);
> Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
> Lw:=LowestSince(1,M,L);
> Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
> Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
> Hw:=ValueWhen(1,Hw>0,Hw);
> Lw:=ValueWhen(1,Lw>0,Lw);
> Cw:=ValueWhen(1,Cw>0,Cw);
>
> A:=If(ValueWhen(3,J,Hw),<   ,ValueWhen(8,Cw>0,Cw),
> If(ValueWhen(3,J,Hw),<,ValueWhen(9,Cw>0,Cw),
> If(Hw,<,ValueWhen(6,J,Lw),
> If(Hw,<,ValueWhen(7,J,Lw),0,1),1),1),1);
> B:=If(ValueWhen(3,J,Lw),>   ,ValueWhen(8,Cw>0,Cw),
> If(ValueWhen(3,J,Lw),>,ValueWhen(9,Cw>0,Cw),
> If(Lw,>,ValueWhen(6,J,Hw),
> If(Lw,>,ValueWhen(7,J,Hw),0,1),1),1),1);
> X:=Cum((J>0)*A);
> Y:=Cum((J>0)*B);
> D:=(X)   * (Y) * (Hw-ValueWhen(3,J,Hw) ) +((X) * (Y)   *
> (Lw-ValueWhen(3,J,Lw)));
> E:=(Abs(Hw-ValueWhen(3,J,Hw) +   Abs(Lw-ValueWhen(3,J,Lw)));
> Sum((D),8) / Sum((E),8)
>
>
> As far as I   can see I have done everything correctly however
> metatstock rejects my 2nd   last line
>
> E:=(Abs(Hw-ValueWhen(3,J,Hw) +   Abs(Lw-ValueWhen(3,J,Lw)));
> Sum((D),8) / Sum((E),8)
>
> What have I done   wrong?
>
> Cheers
>            
> ---------------------------------
>  Too much spam in your inbox? Yahoo! Mail gives you the best spam
protection for FREE!
> http://in.mail.yahoo.com





Yahoo! Groups Links