Ken
are you sure of this ValueWhen(Ref(C,-1),C); ???

this just looks back to when the last previous bar close price was not zero


--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com


On 19/01/07, Ken Close <[EMAIL PROTECTED]> wrote:

 Graham,  thanks.  I first tried that but had to get cute and include it
in some other conditions (IIF) and didn't get anything.  A simple
ValueWhen(Ref(C,-1),C); did the trick.

Ken

 ------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Graham
*Sent:* Thursday, January 18, 2007 7:31 PM
*To:* [email protected]
*Subject:* Re: [amibroker] Maximum Loss in Trade in an Exploration

you can use valuewhen(buy,c) to get the price at entry
provided you do not have additional buy signals when within the trade, see
other discussion recently abouyt how to cope with this


--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com

On 19/01/07, Ken Close <[EMAIL PROTECTED]> wrote:
>
>  I have tried without success to define some code that will let me
> display a column of values for each ticker in a watchlist which shows the
> maximum loss in any one trade over the date range.  I have not been able to
> "capture" the closing price on the day of a buy, maintain it, then capture
> the closing price on the day of the next sell, compute the percent change of
> these two values, then finally get the minimum or lowest of these values
> over the range of the test (over various buy/sell round trips.
>
> Is there any way to do this, short of stepping into the custom
> backtester (which I doubt would do the job anyway on a watchlist of
> tickers)?
>
> I could post some code attempts but they have all been way off the mark.
> Maybe because it is not possible.
>
> Any suggestions??
>
> Thanks,
>
> Ken
>





Reply via email to