| 
 PureBytes Links 
Trading Reference Links 
 | 
Title: Re: [amibroker] [AFL help] exploration for relative strength:found BarsSince
Maybe it’s "especially at my age" ;-) 
 
Anyhow, hopefully there’s a typo below, otherwise you’re not getting the answers you think. You have defined BaseIndex = "XAO"; and then you put BaseIndex inside quotes in the next line. This will not be found since I doubt you have a ticker named "BaseIndex", thus your currently selected symbol will be used with NO ERROR MESSAGE. 
--  
Terry 
 
 From: kris45mar <kris45mar@xxxxxxxxx> 
Reply-To: amibroker@xxxxxxxxxxxxxxx 
Date: Sun, 12 Dec 2004 02:13:12 -0800 (PST) 
To: amibroker@xxxxxxxxxxxxxxx 
Subject: Re: [amibroker] [AFL help] exploration for relative strength:found BarsSince 
 
OK I will answer my own question. 
(Amazing how going for a bike ride, leaving the PC and coming back to it later clears the brain, even at my age!!) 
  
I have found a way of doing this with the BarsSince function: 
  
BaseIndex = "XAO"; 
 
rs =RelStrength("BaseIndex"); 
MA_rs= EMA(rs,30); 
 
Cond1 = rs > MA_rs; 
Cond2 = Cross(rs, MA_rs); 
 
Filter = Cond1 AND BarsSince(Cond2) > 5 ; 
 
AddColumn(BarsSince(Cond2) >= 5; 
 
Plot(rs,"RS",colorGreen,1); 
Plot(EMA(rs,30),"ema RS",colorBlue,1); 
Regards to all. 
  
ChrisB 
 
kris45mar <kris45mar@xxxxxxxxx> wrote: 
 
Greetings All.. 
 
I want to explore for stocks where the Relative 
strength is currently greater than its own EMA for 
more than the last 5 *sequential* periods. 
 
So far I am using the following filter… Filter = 
Sum(Cond1,10) > 5 ; as in… 
 
BaseIndex = "XAO"; 
 
rs =RelStrength("BaseIndex"); 
MA_rs= EMA(rs,30); 
 
Cond1 = rs > MA_rs; 
 
Filter = Sum(Cond1,10) > 5 ; 
 
AddColumn(RelStrength("BaseIndex"),"RS vs XAO",1.2); 
AddColumn(EMA(RelStrength("BaseIndex"),30),"EMA30 RS", 
1.2); 
AddColumn(Sum(Cond1,10),"days over",1.2); 
 
Plot(rs,"RS",colorGreen,1); 
Plot(EMA(rs,30),"ema RS",colorBlue,1); 
 
PROBLEM: this gives me total no. of times Cond1 has 
occurred within the last 10 periods, even if the 
condition does not apply at the last bar, and only 
*totals* the number of times this has occurred, and 
they  may or may not be sequential/continuous. 
 
GOAL: I want to be able to explore for stocks where 
the Relative Strength is *currently* greater than its 
own EMA for more than say 5 continuous/sequential 
periods, and then rank them according to those that 
outperformed for the longest. 
 
I NEED: AFL code for a filter that returns shares 
where the cond1 has been true for > 5 sequential 
periods and is still true at the moment. 
 
What functions in AFL code can I use here? 
 
TIA 
 
ChrisB 
 
 
 
 
 
 
__________________________________________________ 
Do You Yahoo!? 
Tired of spam? Yahoo! Mail has the best spam protection around  
http://mail.yahoo.com  
 
 
------------------------ Yahoo! Groups Sponsor --------------------~-->  
$4.98 domain names from Yahoo!. Register anything. 
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/GHeqlB/TM 
--------------------------------------------------------------------~->   
 
Check AmiBroker web page at: 
http://www.amibroker.com/ 
 
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/ 
 
 
 
 
  
 Do you Yahoo!? 
 Yahoo! Mail - Find what you need with new enhanced search. Learn more. <http://us.rd.yahoo.com/evt=29917/*http://info.mail.yahoo.com/mail_250>  
 
Check AmiBroker web page at: 
http://www.amibroker.com/ 
 
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html  
 
 
Yahoo! Groups Sponsor  
  <http://us.ard.yahoo.com/SIG=1293j1oaj/M=324847.5707096.6763800.3001176/D=groups/S=1705632198:HM/EXP=1102932794/A=2343726/R=0/SIG=12itnnr64/*http://clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=1102846394474230>  Get unlimited calls to U.S./Canada  <http://us.ard.yahoo.com/SIG=1293j1oaj/M=324847.5707096.6763800.3001176/D=groups/S=1705632198:HM/EXP=1102932794/A=2343726/R=1/SIG=12itnnr64/*http://clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=1102846394474230>   
 
 Yahoo! Groups Links 
 
  
Check AmiBroker web page at: 
http://www.amibroker.com/ 
 
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
  
 
| Yahoo! Groups Sponsor | 
 
ADVERTISEMENT
 ![click here]()  |  
  | 
 
![]()  |  
 
 
 
Yahoo! Groups Links 
 |