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

Re: rembuy.dll



PureBytes Links

Trading Reference Links

hello,

below is a detailled example ( of course in franglish) of 
rembuytrail only for LONG side.
feel free to ask question on this example

stephane

Title=Name() + " RemBuy TRAIL" ;

/****Definition of your Buy signal****/
Buy= Cross(H,HHV(Ref(H,-1),5)) AND Ref(MFI(14)>50,-1) ;/* you must 
convert it to one bar peak 
the exit will be never possible in the entrybar ( for this purpose 
there is an other dll called scRemBuyTrailF) , but next bar after 
buy signal*/

/*****************************/
Entryprice= Close;/*entryprice,you can write a buystop, if you want 
to enter on open next bar you must write entryprice = open and give 
ref(buy,-1) to the dll*/

StopPrice= L; /* this is the price option for STOPLOSS AND 
TRAILINGSTOP you can choose Close or Low,
the exit price will be the low or open ( if gap) if you choose Low 
as stopprice
OR the exit price will be close if you choose close as stopprice*/

StopLoss= Min(Entryprice*0.94, Max( LLV(L,14), L-ATR(3) ) );/* you 
must give your stoploss as an array, you don't need of valuewhen the 
dll makes it for you*/

/*******Optimize Stop********/
/* below is a Tips to backtest different trailing stop, the trailing 
stop is initialized the day of the buy signal*/
stop= Optimize("stop", 1, 1, 3, 1 ); 
Trailstop= 
IIf( stop==1,C-4*ATR(30),
IIf( stop==2, L-3*ATR(30),scCBLLong(5)));

Pf=1.5;/*profit factor for target, in this case it means 10 times 
the difference between your entryprice and your stoploss, but you 
can write entryprice*1.01 to get one % of profit, */
Target= (1+Pf)*Entryprice - Pf*stopLoss;
/*your exit price will be the profit or the open (if gap), you can 
disable it with an impossible target ( C*1e10) */

ExitBin= 0; //it is a binary exit you can disable it with zero
Bars= -1 ;/* that is the number of bars to exit if the close is 
below your entryprice you can disable it with -1, for example if you 
write 10 bars that means that if after 10 bars the close is below 
the entryprice, exit next day at open*/

/* KEEP the oRDER++++*/
scRemBuyTrail(Buy,Entryprice,
StopPrice,StopLoss,TrailStop,
Target,ExitBin,Bars);
/* the dll returns the buy and the sell, all new buys that could 
occur during the trade are removed until the trade is finished*/
Buy=Buy; 
Sell=Sell;
BuyPrice=Entryprice;/*array*/
SellPrice=SellPr;/*array sellpr is given by the dll: next open if 
you choose exit on bar, close if you choose close as stopprice, stop 
or open ( if gap) in others cases*/ 


/* below are charts*/
Entryprice=ValueWhen(Buy,Entryprice);
Stoploss=ValueWhen(Buy,StopLoss);
profit =ValueWhen(Buy,Target) ; 
Trail=HighestSince(Buy,Trailstop);

MaxGraph=14;
Plot(Close,"close",IIf( Buy, 6, IIf(Sell , 4 ,1 )),64);
Plot(Entryprice,"Ep",3,1);
Plot(Stoploss,"stop",4,1);
//Plot(Profit,"Profit",7,1);
Plot(TargetPr,"",6,1);
/* targetpr and trailpr are returned by the dll*/
Plot(TrailPr,"TrailPr",5,1);
Plot(ValueWhen(Sell,SellPrice),"",2,1);

//Plot(Buy*10,"",6,2);
//Plot(Sell*5,"",7,2);

> Stephane,
> 
> Thanks in advance for your help. I really appreciate it.
> 
> Also, your help file is fine for most, I'm sure--unfortunately, 
when it
> comes to programming, I'm a dunce.
> 
> Thanks, Stephane.
> 
> Harold Harper
> harold@xxxx
> 
> -----Original Message-----
> From: Stephane Carrasset [mailto:nenapacwanfr@x...] 
> Sent: Thursday, October 10, 2002 2:51 PM
> To: amibroker@xxxx
> Subject: [amibroker] Re: rembuy.dll
> 
> 
> Harold,
> 
> for several reasons ( profession.) the only thing I can do is to 
> give an example with explanations. because of my good 
franglish !!!, 
> it takes too much time to write better help files.
> i'll write an example tonite in a few hours, just before going to 
bed
> 
> 
> stephane
> 
> 
> > Does anyone have a 'cheat sheet' of sorts for the rembuy.dll.
> > 
> > I'm looking for a list of functions available, syntax, examples,
> etc. 
> > I've looked at the help file in the 3rd party directory and am a
> > little confused.
> > 
> > The dll looks to be, however, exactly what I need.
> > 
> > Any help would be greatly appreciated.
> > 
> > Thanks!
> > 
> > Harold Harper
> > harold@xxxx
> 
> 
> 
> 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
> http://docs.yahoo.com/info/terms/