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

[amibroker] Re: Need help with ApplyStop strategy



PureBytes Links

Trading Reference Links

I didn't test this, but something like following should work (or at 
least get you started in the right direction) -

Buy = your-buy-condition
Sell = False;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

rsiCross = Cross(RSI(), 80);
useTrailStop = BarsSince(rsiCross) < BarsSince(Buy);

stopVal = Min(L, Ref(L, -1));
stopVal = IIf(Buy, stopVal, IIf(useTrailStop, Ref(L, -1), Ref
(stopVal, -1)));
ApplyStop( ... );


Jitu

--- In amibroker@xxxxxxxxxxxxxxx, "avanti12001" <anton.denijs@xxxx> 
wrote:
> Hello,
> 
> I am testing a trading strategy, but I still need to implement a 
stop 
> and I don't know how to solve this. Could you please help me?
> 
> The conditions for the stop are as follows:
> 
> - An initial stop is placed at the lowest value of the date of Buy 
or 
> the bar before (whichever is lowest)
> 
> - If the RSI crosses 80, the initial stop becomes a trailing stop. 
> The stop is placed at the lowest value of the day before. If the 
> lowest low of the day before is higher than the present value, the 
> stop is executed.
> 
> Could anyone provide me with a solution or hints to build the above 
> situation in Amibroker.
> 
> Your help is much appreciated. 
> 
> Kind regards,
> 
> Anton de Nijs


------------------------ 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/mOAaAA/3exGAA/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/