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

[amibroker] Re: ApplyStop() problem



PureBytes Links

Trading Reference Links

Gordon,

Depending on your buy conditions, you might still get buy signals 
even when in a trade.

Check out the ExRem, ExRemSpan, and Equity(1) functions to get around 
this.

HB

--- In amibroker@xxxxxxxxxxxxxxx, "gordonwrose" <amibroker@xxxx> 
wrote:
> Hi Herman,
> 
> Maybe this will help. I style my backtests along the following:
> 
> BuySetup = conditions...
> 
> // -- We buy on the day following the buy setup
> Buy = BarsSince(BuySetup) == 1 and conditions...
> 
> // --- Here we have two reasons to sell -- a profit
> //     stop and a stop loss
> SellRule01 = H >= 1.1 * ValueWhen(BuySetup, C, 1);
> SellRule02 = L < Ref(L, -1);
> Sell = SellRule01 or SellRule02;
> 
> // -- We base the sell price on which sell rule kicked in
> SellPrice=iif(SellRule01, 1.1 * ValueWhen(BuySetup, C, 1), Ref(L, -
> 1));
> 
> This seems to work and to give me the flexibility I want. You can 
> string together iif statements. What you're looking at in 
SellRule01 
> is the most recent buysetup -- I have been meaning to confirm with 
> Tomasz that AB does not calculate new buysetups if you are already 
in 
> trade.
> 
> Gordon
> --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen" 
> <psytek@xxxx> wrote:
> > The ApplyStop() is giving me a hard time, can somebody tell if it 
is
> > possible to set it up to exit at a profit based on the Close from 
> the day
> > before the trade was entered?
> > 
> > For example: i get a signal today and want to calculate the 
profit 
> target
> > based on today's Close, say, if the Close was $20 today, i enter 
the
> > position tomorrow, then i want it to close whenever the price 
> exceeds 10%
> > above today's Close, i.e. $22. I do not want the profit 
calculated 
> from the
> > entry price or any price during the trade.
> > 
> > many thanks for any help you can give,
> > Herman.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sO0ANB/LIdGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(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/