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

Re: [amibroker] Referencing buy attributes to sell



PureBytes Links

Trading Reference Links


Hi, Mark. Welcome to the Amibroker users group. 
 
You need to use Stephane Carrasset's RemBuy.dll, which you can download 
from the files section of the Yahoo AB group site. If Stephane is reading this, 
jump in and correct me if I'm wrong, Stephane. Here is an example code:
 
BuyCond = <your buy condition>;Buy = ref(buy,-1); //enter at open 
the next day after buy condition is trueEP = Open; //entry price is the 
opening priceProfit = EP + 2*ATR(20);//your profit targetStopLoss= 
valuewhen(Buy,Open - n*ATR(20));//set n at anything you want or optimize 
itTrailStop = H-m*ATR(15);//a trailing stop where m can be anything you 
wantBars = -1;//any other setting here allows another stop to exit ata set 
no. of barsscRemBuyTrail(Buy, Close, EP, StopLoss, Profit, TrailStop, 
Bars);//the call of the dllBuy=Buy;Sell=Sell;//ensures the buy and sell 
are arraysBuyPrice = EP;SellPrice = Open;Short = 0;Cover = 
0;EP = ValueWhen(Buy, EP);//for plotting purposesIStop = valuewhen(Buy, 
stoploss);//for plotting purposesTStop = HighestSince(Buy, Trailstop);//for 
plotting purposes
 
The above code gives an example of a profit target, a stop loss, and a 
trailing stop all in one. Hope this helps.
 
Al Venosa
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
MarkB 

To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Sunday, September 29, 2002 5:32 
AM
Subject: [amibroker] Referencing buy 
attributes to sell
Hi All from a new AmiBroker user. I just love it so far, 
I've made moreprogress in backtesting in the last week in Ami than in 
MetaStock in thelast few months.Anyway, a question.What I 
want to do is base sell conditions based on conditions at time ofbuying. I 
might want to use a profit target based exit which depends on aprice 
calculated on the day the buy condition is generated. An example wouldbe I 
want to sell when the equity reaches the value of CLOSE + 2 * ATR(20)on 
the day the buy signal is generated. Any ideas how I can achieve this 
inAFL?I have more similar questions, but let's cover one at a 
time  :)Cheers,MarkPost 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.