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

[amibroker] Re: Big time problem with trade exit.



PureBytes Links

Trading Reference Links

Thanks Dave, and it's probably me doing the misunderstanding.

A long position may span many days. If, at any time, the LOW is below 
MyLongStop then exit the trade at the next day open - otherwise 
remain in the trade until the next Sell signal.

Similarly, a short position may also span many days. If,at any time, 
the HIGH is above MyShortStop etc. etc.

The stops are intended to limit losses to 5% although the actual loss 
may be more or less because the Low/High isn't known until eod.

As you can see below, I have been trying to achieve this using 
ApplyStop but I seem to be looking into the future.

Hope it's clear and if you, or anyone, have any suggestions they 
would be appreciated.

Keith
 
--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx> 
wrote:
> uh, that was supposed to be "sorry if *I* missed the point...
> 
> dave
>   I'm probably misunderstanding something basic here, but why not 
skip the
> buy
>   in that case, instead of entering it and exiting later the same 
day? in
>   other words, add the condition Ref(Low, -1) > MyStop to the buy 
condition.
> 
>   or are you trying to make a profit on that partial day when this 
sequence
>   happens?
> 
>   sorry if you missed the point...
> 
>   dave
> 
>   > It would be nice to exit longs at the open if you knew your 
stops
>   > would be hit later in the day. That seems to be what I'm doing 
with
>   > the following illustrative code.
>   >
>   > Cl = Foreign("QQQ","Close");
>   > BuyPrice=SellPrice=ShortPrice=CoverPrice=Open;
>   > SetTradeDelays(1,1,1,1);
>   > ApplyStop(stopTypeLoss,stopModePercent,5,True);
>   > Buy = Cross(EMA(Cl,5),MA(Cl,15));
>   > Sell = Cross(MA(Cl,15),EMA(Cl,5));
>   > Equity(1);
>   > Short = Sell; Cover = Buy;
>   > Equity(1);
>   >
>   > What I'm trying to do is to trade QQQ at the open as called by 
my Buy
>   > & Sell conditions, but to exit the trade at the open if the 
previous
>   > day's low was below my stop, and then wait for the next trade 
signal.
>   >
>   > The 1/7/03 long position (with a 5% StopLoss) was closed at the 
open
>   > on 1/21/03 but the stop wasn't hit until later that same day :-(
>   >
>   > Does anyone know how I should change the code so that it 
activates
>   > the stop based on the prior day's bar?
>   >
>   > I have the range set for 01/01/02 to 09/12/03. In Settings I
>   > have "Activate stops immediately" and "Allow same day exit" 
checked.
>   > I'm using eod data.
>   >
>   > Keith


------------------------ 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/l.m7sD/LIdGAA/qnsNAA/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/