PureBytes Links
Trading Reference Links
|
Hello Walid,
What you are saying with the formula ( sell=ref(buy,-n);) is this : Sell
when your buy was 5 days ago.
Also, I believe the correct formula for selling n days after a buy
should be this:
buy="your buy condition";
Buy = ExRemSpan( Buy, 5 );
Sell = Ref( Buy, -5 );
/**********************************************************************/
>From the Help guide:
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 = 1;
Buy = ExRemSpan( Buy, 5 );
Sell = Ref( Buy, -5 );
Best Wishes
Anthony
Walid Atia wrote:
> All,
>
> I know this has been answered before, but I couldn't
> seem to find it. If one wants to sell n days
> after a buy signal, the code:
>
> n=5;
> sell=ref(buy,-n);
>
> will sell 5 days after the buy. This is kind of
> unintuitve in that one might think n should
> be positive to sell in the future. Why is this?
>
> Thanks,
>
> Walid
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
>
> Yahoo! Groups Sponsor
ADVERTISEMENT
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|