PureBytes Links
Trading Reference Links
|
mn= valuewhen(buy,ref(low,-1))
with this u have the value of low...then apply it to stop
----- Original Message -----
From: "Keith Bennett" <kbennett@xxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, September 15, 2003 1:22 PM
Subject: [amibroker] Big time problem with trade exit.
> 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
>
>
>
> 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/
>
>
>
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/
|