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

Re: [amibroker] AFL for Time based stop ?



PureBytes Links

Trading Reference Links

Sam,

I am not sure if this is what you are looking for.

This is from the Help file:

EXREMSPAN - remove excessive signals spanning given number of bars (AFL
2.0)

SYNTAX exremspan( ARRAY1, numbars )
RETURNS ARRAY
FUNCTION Removes excessive signals that span numbars bars since initial
signal.
(In other words first non-zero bar passes through, then all subsequent
non-zero bars are ignored (zero is returned) until numbars bars have
passed since initial signal. From then on a new signal may pass through)

This function makes easy writing exits after a fixed number of bars, for
example if you want to sell always 5 bars after the buy you should now
use combination of ExRemSpan and Ref(). It will work even if initial buy
array has lots of redundant signals:


EXAMPLE ;

Buy = Your buy condition here;
Buy = ExRemSpan( Buy, 5 );
Sell = Ref( Buy, -5 );


Anthony


samgrayy wrote:

> Hi all.
>
> Is there a way to implement a time-based stop in AFL
> I tried this .. but since there may be multiple buy signals during a
> trade I still see trades that last many more bars than 7 ..
>
> Sell = BarsSince (Buy) > 7 ;
>
> Thanks in advance,
> Sam Gray
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT


>
> 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 the Yahoo! Terms of Service.