PureBytes Links
Trading Reference Links
|
Or perhaps try this:
==========
CCI system
==========
---8<----------------
{ CCI system signals v2.0 }
{ ©Copyright 2005 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }
{ User inputs }
pds:=Input("Commodity Channel Index periods",
1,260,14);
pds1:=Input("Consecutive Close>Open events",
1,21,2);
plot:=Input("Signals: [1]Clean, [2]All, [3]Trade binary",1,3,1);
delay:=Input("Entry and Exit delay",0,5,0);
{ CCI crossover signals }
x:=CCI(pds);
long:=Alert(Cross(x,0),pds1);
short:=Alert(Cross(0,x),pds1);
{ Confirm signals with open candles }
entry:=Ref(long,-1) AND Sum(C>O,pds1)=pds1;
exit:=Ref(short,-1) AND Sum(C<O,pds1)=pds1;
{ Clean signals }
Init:=Cum(IsDefined(entry+exit))=1;
x:=ValueWhen(1,entry-exit<>0 OR Init,
entry-exit);
long:=x=1 AND (Alert(x<>1,2) OR Init);
short:=x=-1 AND (Alert(x<>-1,2) OR Init);
signals:=long-short;
binary:=ValueWhen(1,signals<>0 OR Init,signals);
{ Plot in own window }
Ref(If(plot=2,entry,0),-delay);
Ref(If(plot=1,signals,
If(plot=2,-exit,binary)),-delay)
---8<----------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" <josesilva22@xxxx>
wrote:
>
> Jay, try this indicator code:
>
> ==========
> CCI system
> ==========
> ---8<-----------------
>
> { CCI system signals }
> { ©Copyright 2005 Jose Silva }
> { For personal use only }
> { http://www.metastocktools.com }
>
> { User inputs }
> pds:=Input("Commodity Channel Index periods",
> 1,260,14);
> pds1:=Input("Consecutive Close>Open events",
> 1,21,2);
> plot:=Input("Signals: [1]Clean, [2]All, [3]Trade binary",1,3,1);
> delay:=Input("Entry and Exit delay",0,5,0);
>
> { Signals }
> x:=CCI(pds);
> long:=Cross(x,0);
> short:=Cross(0,x);
>
> { Trade binary }
> Init:=Cum(IsDefined(long+short))=1;
> binary:=ValueWhen(1,long-short<>0 OR Init,
> long-short);
> entry:=binary=1 AND Sum(C>O,pds1)=pds1;
> exit:=binary=-1 AND Sum(C<O,pds1)=pds1;
>
> { Clean signals }
> x:=ValueWhen(1,entry-exit<>0 OR Init,
> entry-exit);
> long:=x=1 AND (Alert(x<>1,2) OR Init);
> short:=x=-1 AND (Alert(x<>-1,2) OR Init);
> signals:=long-short;
> binary:=ValueWhen(1,signals<>0 OR Init,signals);
>
> { Plot in own window }
> Ref(If(plot=2,entry,0),-delay);
> Ref(If(plot=1,signals,
> If(plot=2,-exit,binary)),-delay)
>
> ---8<-----------------
>
>
> jose '-)
> http://www.metastocktools.com
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "whiler178" <jemem@xxxx>
> wrote:
>
>
> I would appreciate some help in creating a binary formula which
> reads true when CCI crosses 0 in either direction and when long has
> two consecutive days of "close > open" or when short has two
> consecutive days of "close < open". The formula should only read the
> first of the two day qualifier.
> Thanks for any help.
> Jay
------------------------ Yahoo! Groups Sponsor --------------------~-->
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/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/
|