PureBytes Links
Trading Reference Links
|
Thanks ! It's very clear now. I'm trying to write Divergence using
Valuewhen() instead of using "Peak" in Expert. I wrote the code below :
b1 := Ref(Stoch(5 ,3 ),0) > Ref(Stoch(5 ,3 ),+1) AND Ref(Stoch(5 ,3 ),0) >
Ref( Stoch(5 ,3 ),-1) ;
If(If( ValueWhen(1 ,b1 ,Ref(Stoch(5 ,3 ),0 )< ValueWhen(2 ,b1 ,Ref(Stoch(5
,3 ),0) )
AND ValueWhen(1 ,b1 ,H )> ValueWhen(2 ,b1 ,H )),b1,0),1,0);
It works fine using two ValueWhen() but when I use three ValueWhen() it does
not work correctly. The code is as below :
b1 := Ref(Stoch(5 ,3 ),0) > Ref(Stoch(5 ,3 ),+1) AND Ref(Stoch(5 ,3 ),0) >
Ref( Stoch(5 ,3 ),-1) ;
If(If( ValueWhen(1 ,b1 ,Ref(Stoch(5 ,3 ),0 )> ValueWhen(2 ,b1 ,Ref(Stoch(5
,3 ),0) and ValueWhen(1,b1,ref(Stoch(5,3),0) <
ValueWhen(3,b1,ref(Stoch(5,3),0) )
AND ValueWhen(1 ,b1 ,H )> ValueWhen(2 ,b1 ,H ) and ValueWhen(2,b1,h) >
ValueWhen(3,b1,h)))),b1,0),1,0);
Could you help .
Thanks !
----- Original Message -----
From: "Jose" <josesilva22@xxxxxxxxx>
To: <equismetastock@xxxxxxxxxxxxxxx>
Sent: Monday, January 24, 2005 2:25 AM
Subject: [EquisMetaStock Group] Re: Valuewhen()
>
>
> ValueWhen(1,XX,YY) will plot the YY value of the *last* time condition
> XX occurred.
>
> ValueWhen(1+1,XX,YY) is the same as ValueWhen(2,XX,YY), and it will
> plot the YY value of the *second last* time condition XX occurred.
>
>
> jose '-)
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, mwtang <mwtang@xxxx> wrote:
> > Thanks Jose , I had read through Roy's mail and Andrew's mail.
> > I have some confuse in one of the code :
> >
> > BarDiff1:=ValueWhen(1,SignalIn OR Init,
> > ValueWhen(1+1,1,BarsSince(SignalIn OR Init))+1);BarDiff1;
> >
> > What is the difference between ValueWhen(1,XX,YY) and
> > ValueWhen(1+1,XX,YY).Could you please explain about this.
> > Thanks you very much.
> >
> > Mun Wai.
> >
> >
> > ----- Original Message -----
> > From: "Jose" <josesilva22@xxxx>
> > To: <equismetastock@xxxxxxxxxxxxxxx>
> > Sent: Sunday, January 23, 2005 3:11 AM
> > Subject: [EquisMetaStock Group] Re: Valuewhen()
> >
> >
> >
> >
> > The short answer is, yes, you can reference any prior condition
> > occurrence with the very handy MS ValueWhen() function.
> >
> > And as Roy has pointed out in a back issue of the MSTT newsletter,
> > you can also nest ValueWhen() functions inside each other.
> >
> > Anyway, try the code below - it doesn't use any forward-referencing
> > to determine peaks/troughs.
> >
> > ---8<--------------------------
> >
> > { http://www.metastocktools.com }
> >
> > { User inputs }
> > back:=Input("Reference last x Stoch Peak/Trough value",1,100,1);
> > pds1:=Input("%k periods",2,260,5);
> > pds2:=Input("%k slowing",1,260,3);
> >
> > { Stochastic }
> > St:=Stoch(pds1,pds2);
> >
> > { Stoch peaks }
> > pk:=Ref(St,-1)>St AND Ref(St,-1)>Ref(St,-2);
> > pkVal:=ValueWhen(back,pk,Ref(St,-1));
> >
> > { Stoch troughs }
> > tr:=Ref(St,-1)<St AND Ref(St,-1)<Ref(St,-2);
> > trVal:=ValueWhen(back,tr,Ref(St,-1));
> >
> > { Plot in own window }
> > St; { Green }
> > pkVal; { Red }
> > trVal; { Blue }
> >
> > ---8<--------------------------
> >
> >
> > jose '-)
> > http://www.metastocktools.com
> >
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, mwtang <mwtang@xxxx> wrote:
> > I would appreciate help in using Valuewhen(). For example :
> >
> > b1 := Ref(Stoch(5 ,3 ),+0) < Ref(Stoch(5 ,3 ),+1)
> > AND Ref(Stoch(5 ,3),+0) < Ref( Stoch(5 ,3 ),-1) ;
> >
> > ValueWhen(1 ,b1 ,Ref(Stoch(5 ,3 ),+0 )>
> > ValueWhen(2 ,b1 , Ref(Stoch(5 ,3 ),+0);
> >
> > Could I use more than two valuewhen() i.e
> > ValueWhen(3 ,b1 ,Ref(Stoch(5 ,3 ),+0 ) or
> > ValueWhen(4 ,b1 ,Ref(Stoch(5 ,3 ),+0 )
> > Thank in advance.
> > Regards.
> > mun wai.
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/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/
|