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

[amibroker] Big time problem with trade exit.



PureBytes Links

Trading Reference Links

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/