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

Re: Referencing buy attributes to sell



PureBytes Links

Trading Reference Links

Hi, Al,

the new versions of rembuy ( uploaded in third party) are more and 
more complex.
reason why I would like to add a dialog box ( it is not easy to 
write for me)
I write them for my backtests and if someone can use them.
you're right with stoploss, target and trailing, all things that 
applystop can do.

the dll gives you the choices
of exit on a number of bars if the close is below your entry price
you can initialize the trailing stop when the profit is reached, and 
get a protective stop between your entryprice and your target...

in fact after many backtest, the simple and often the best is one 
trailingstop.
so applystop can be enough.

stephane
> 
> 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 true
> EP = Open; //entry price is the opening price
> Profit = EP + 2*ATR(20);//your profit target
> StopLoss = valuewhen(Buy,Open - n*ATR(20));//set n at anything you 
want or optimize it
> TrailStop = H-m*ATR(15);//a trailing stop where m can be anything 
you want
> Bars = -1;//any other setting here allows another stop to exit at 
a set no. of bars
> scRemBuyTrail(Buy, Close, EP, StopLoss, Profit, TrailStop, 
Bars);//the call of the dll
> Buy=Buy;
> Sell=Sell;//ensures the buy and sell are arrays
> BuyPrice = EP;
> SellPrice = Open;
> Short = 0;
> Cover = 0;
> EP = ValueWhen(Buy, EP);//for plotting purposes
> IStop = valuewhen(Buy, stoploss);//for plotting purposes
> TStop = 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
> ----- Original Message ----- 
> From: Mark B 
> To: amibroker@xxxx 
> 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 more
> progress in backtesting in the last week in Ami than in 
MetaStock in the
> last few months.
> 
> Anyway, a question.
> 
> What I want to do is base sell conditions based on conditions at 
time of
> buying. I might want to use a profit target based exit which 
depends on a
> price calculated on the day the buy condition is generated. An 
example would
> be 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 in
> AFL?
> 
> I have more similar questions, but let's cover one at a time :)
> 
> Cheers,
> 
> Mark
> 
> 
> 
> Yahoo! Groups Sponsor 
> ADVERTISEMENT
> 
> 
> 
> 
> Post AmiQuote-related messages ONLY to: amiquote@xxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> 
> Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.