Hi Gonzaga -- Check the users guide for "ApplyStop".
Your afl can have more than one exit, and it is common for a trading system to include both exits described by logic (Sell = xxx;) and by ApplyStop -- perhaps more than one of each. If you have several ApplyStop statements (profit target, trailing stop, maximum holding period), AmiBroker keeps them straight. If you have several logic exits, assign each its own variable name (SellCond1 = xyz; SellCond2 = wxy;), then combine them into one Sell statement (Sell = SellCond1 OR SellCond2;). The precedence and order in which stops and logic exits are applied and depends on settings. If you have very complicated exits, you might want to write looping code to handle them. This gives you complete control, assurance that you understand how they are being applied, and the ability to debug them using Plot and AddColumn statements. Thanks, Howard On Tue, Jun 15, 2010 at 4:42 PM, Gonzaga <gonzag...@yahoo.es> wrote: > > > I've just realized that my problem my be related with the sell signal. > For I use a profit stop, but also a sell condition; and both are different. > > So, how does combine sell conditions with stops? > > Could I have problems if I mix both? > > > --- In amibroker@yahoogroups.com <amibroker%40yahoogroups.com>, "Gonzaga" > <gonzag...@...> wrote: > > > > Hi. I have an idiot doubt. Sometimes AFL gets me crazy :-) > > > > I have applied a very simple stop profit: > > > > //--------------------------------------- > > SetTradeDelays(1,1,1,1); // buy or sell after signal > > //SetOption("ActivateStopsImmediately",False); --> I don't know the use > of this > > stoplevelp=1; > > ApplyStop(stopTypeProfit, stopModePercent, stoplevelp, 1);//1: exit > intraday on same bar > > //--------------------------------------- > > > > So I though the profit stop sell the stock even in the day of buy, just > 1% over buy price. > > > > But I see, it sells 1,3% over buyprice. or more.. > > In settings I have established a commission table of 0.005 per share, so > I suppose that's not related. > > > > And, also, how does it work the axtivatestopsimmedately? > > > > Is there any good help file to study all these..? > > Thanks a lot.. > > > > >