PureBytes Links
Trading Reference Links
|
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 --------------------~-->
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/
|