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

RE: [amibroker] TimeFrameSet question for TJ



PureBytes Links

Trading Reference Links

Dear Traders, 
 
may I please ask for your help - how do I have to program the 
following 
"trailing stop system" of my broker CMS in AFL, to backtest/optimize 
the "n pips" stop values ?
 
Thank you for your help in advance.
Kind regards
Robert
 
 
{Trailing Stop Loss}
TrStopLevel:=If(C=PREV, PREV, If(((Ref(C,-1)<PREV)
AND (C<PREV)), Min(PREV,C*(1+nPips)), If((Ref(C,-1)>PREV) 
AND (C>PREV), Max(PREV,C*(1-nPips)), If(C>PREV,C*(1-nPips),C*
(1+nPips)))));

{Signal Up and Down}
Up:= Cross(Close,TrStopLevel);
Down:= Cross(TrStopLevel,C);
 
{OpenBuy, CloseBuy, OpenSell, CloseSell}
OpenBuy:= Up and (eventCount('OpenBuy')= eventCount('CloseBuy'));
CloseBuy:= Down and (eventCount('OpenBuy')>eventCount('CloseBuy'));
OpenSell:=  Down and (eventCount('OpenSell')= eventCount
('CloseSell'));
CloseSell:=  Up and (eventCount('OpenSell')>eventCount('CloseSell'));






------------------------ 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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/