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

RE: [amibroker] Maximum Loss in Trade in an Exploration



PureBytes Links

Trading Reference Links

Yikes! No wonder I have such a time...
 
ValueWhen(Ref(Buy,-1),C);  One day delay.
 
Sorry about that....
 
Full snippit:
PriceB = ValueWhen(Ref(Buy,-1),C);

PriceS = ValueWhen(Ref(Sell,-1),C);

TradeProfit = IIf(Ref(Sell,-1), Nz(100 * (PriceS - PriceB)/PriceB), 0);

MLIT = Lowest(TradeProfit);

Worked perfectly.

  _____  

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Graham
Sent: Thursday, January 18, 2007 10:19 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Maximum Loss in Trade in an Exploration


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 <ken45140@xxxxxxxxx> 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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Graham
Sent: Thursday, January 18, 2007 7:31 PM
To: amibroker@xxxxxxxxxxxxxxx
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 <ken45140@xxxxxxxxx> 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










 

Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.14/637 - Release Date: 1/18/2007 1:03 PM