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

[EquisMetaStock Group] Long entry-related timed exit



PureBytes Links

Trading Reference Links

In response to this post at the Equis forum (unable to post MetaStock 
code there):
http://forum.equis.com/forums/thread/21862.aspx

"How to code an exit after x number of days; eg exiting 4 days after 
a moving averages cross over buy signal took place?"


=============================
Long entry-related timed exit
=============================
---8<--------------------------

{ Long entry-related timed exit

 ©Copyright 2004~2006 Jose Silva
  For personal use only.
  http://www.metastocktools.com }

{ User inputs }
exitPds:=Input("Exit trade at x periods",
 1,2600,4);
delay:=Input("Entry and Exit delay",0,5,0);

{ Sample entry conditions }
In:=Cross(C,Mov(C,21,E));

{ Entry-related exit latch }
latch:=If(PREV>0,
 If(BarsSince(PREV<=0)<exitPds,1,-1),In);

{ Clean Entry & Exit signals }
entry:=latch=1 AND Alert(latch<1,2);
exit:=latch=-1;

{ Plot signals in own window }
0;Ref(entry-exit,-delay)

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


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







 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

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