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

Re: [Metastockusers] Length of buy signal



PureBytes Links

Trading Reference Links

Terry


> Is there an easy way to call the length of time since the most recent buy
> signal and use that value in a formula for a sell or stop criteria?

There are any number of ways to do this sort of thing.

One approach is to create an indicator that is identical to your entry
signal and then use Fml("entry signal")  with BarsSince() to determine the
number of periods that have passed.

Do you want to know how many periods have passed since the leading edge or
the trailing edge? Why do you want to use the most recent signal rather than
the first signal? What's to stop subsequent signals being triggered at a
lower price than the first signal and therefore moving your initial (or
other) stop down?

My point is that there are several different answers to you query, and which
is the right way to go for you will probably depend more on what you have
left out of your question than what we see and understand from it.

The following examples may give you some help whatever the unsaid questions
are.

  {count bars since leading edge of last signal}
N:=Fml("entry signal"); {binary entry signal}
X:=BarsSince(N {=TRUE} and Ref(N,-1)=0 {FALSE} );
X;

  {count bars since railing edge of last signal}
N:=Fml("entry signal"); {binary entry signal}
X:=BarsSince(N=0 {FALSE} and Ref(N,-1) {=TRUE} );
X;

To reference the first entry signal and base exit decisions around that you
will need a PREV based latch. How you construct the latch will of course
depend on what you want to do.

  {timed trade exit}
D:=25; {periods}
N:=Fml("entry signal");
X:=0; {independant (of entry) exit signal}
Tr:=If(PREV<=0,N, {set with entry signal}
   If( X {independant exit}
OR
   BarsSince(PREV=0)>=D, {periods since entry}
{OR any other entry related exit}
   -1 {negative spike signals any exit condition},
   1)); {or trade continues}
X:=Tr<0; {exit bar}
Y:=Abs(Tr); {trade in progress}
X;
Y;

Roy



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/