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

[EquisMetaStock Group] Re: Stops & signals



PureBytes Links

Trading Reference Links


Tan, try this indicator code:

---8<-----------------------

{ ©Copyright 2005 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }

{ Indicator signals choice }
plot:=Input("Exit below:  [1]Entry's Low,  [2]Prev day's Low",1,2,1);

{ Long if today's price crosses above yesterday's High }
long:=Cross(H,Ref(H,-1));


{ #1 - Stop below Entry's Low }
stop:=If(PREV=0,If(long,L,0),
 If(L<PREV,0,PREV));

{ First entry signal }
Entry:=stop>0 AND Alert(stop=0,2);

{ Exit signal }
Exit:=stop=0 AND Alert(stop>0,2);

{ True entry Low }
EntryPrice:=ValueWhen(1,Entry,L);

{ Signals }
signals1:=Entry-Exit;


{ #2 - Stop below yesterday's Low }
stop:=Cross(Ref(L,-1),L);

{ Clean signals: preference to first entry/exit}
Init:=Cum(IsDefined(long+stop))=1;
entry:=long AND (Alert(long=0,2) OR Init);
exit:=stop AND (Alert(stop=0,2) OR Init);
binary:=ValueWhen(1,entry-exit<>0 OR Init,entry-exit);
Entry:=binary=1 AND (Alert(binary<1,2) OR Init);
Exit:=binary=-1 AND (Alert(binary>-1,2) OR Init);
signals2:=Entry-Exit;


{ Plot signals in own window }
If(plot=1,signals1,signals2)

---8<-----------------------


jose '-)
http://www.metastocktools.com



--- In equismetastock@xxxxxxxxxxxxxxx, "tan ming" 
<reminiscenostalgia@xxxx> wrote:
> 
> Hi MG Ferreira,
> 
> I am trying to program MS to long if (1) today's price crosses
> yesterday's high by one tick & (2) have a stop below today's low
> if filled. Can anyone knows to do it? Tks.
> 
> Kind Regards.






------------------------ 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/