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

[amibroker] Re: ApplyStop() problem



PureBytes Links

Trading Reference Links

Gordon,

No, you can use ExRem & ExRemSpan on any array.

My system is similar to yours in that I have my buy conditions (in an 
array called buyconds) and then I apply exrem to it.  I then use this 
new buyconds array in addition to other parameters to create the 
actual Buy array.

Similarly, I use stops (time & max loss) in my sell rules and adjust 
SellPrice accordingly.

You might want to modify your SellPrice statement though to account 
for gaps and out of range numbers. It currently does not account for 
these situations, so you might not get accurate results when 
backtesting.

HB

--- In amibroker@xxxxxxxxxxxxxxx, "gordonwrose" <amibroker@xxxx> 
wrote:
> Hi HB,
> 
> Thanks. So, just to confirm -- does exrem apply to Buy and Sell 
only? 
> Those are the example uses in the documentation. Probably doesn't 
> matter, since then I would just use Buy instead of BuySetup in the 
> sell rules, and apply exrem to buy. Very cool. 
> 
> Gordon
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "hmab1" <hossamb@xxxx> wrote:
> > 
> > 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/