Valuewhen has the same issue with redundant signals as Ref does. I was simply answering to the question if Sell = L < Ref(L, - BarsSince(Buy)); is correct. And it is correct.
rgds Ed From: Mike Sent: Wednesday, August 04, 2010 9:30 AM To: amibroker@yahoogroups.com Subject: [amibroker] Re: Exit if L < L of Entry Bar That is true only when you are certain that there are no redundant signals between the actual buy and the actual sell. For example, Buy = Cross(High, 50); Sell = Cross(50, High); will not produce redundant signals (since the opposite cross must occur before a new cross can again occur). However, Buy = High >= 50; Sell = 50 > High; will produce redundant signals (since the price can remain above the threshold for an extended duration) and using BarsSince will not give you the value at the time of the original Buy, but rather at the time of the most recent redundant signal. Mike --- In amibroker@yahoogroups.com, "Edward Pottasch" <empotta...@...> wrote: > > hi, > > yes that is correct. > > same result would be: > > Sell = L < Valuewhen(Buy,L); > > when you make a plot of valuewhen(Buy,L) and Ref(L,-Barssince(Buy)) you find > they give the same result. Ref is a function that supports variable periods: > > http://www.amibroker.com/guide/a_varperiods.html > > regards, Ed > > > > > From: rise_t575 > Sent: Wednesday, August 04, 2010 2:51 AM > To: amibroker@yahoogroups.com > Subject: [amibroker] Exit if L < L of Entry Bar > > > > Hello, > > What would be the correct code for this? > > Is this one 100% correct: > > Sell = L < Ref(L, - BarsSince(Buy)); > > Or do I have to use the the EXREM() function somewhere within the formula (I > don't have any experience with this one)? > > Thanks in advance! >