| Welcome Guest, please  sign in  to participate in a discussion. | Search | 	Active Topics | | 
	
	
	
	|  Registered User
 Joined: 1/20/2005
 Posts: 129
 
 | 
	Hi Bruce, 
	I would really appreciate it if you would you write me a RealCode condition to identify stocks that are up >67% above the lowest low over the past 5 days.  I  know this can be done without RealCode, but, unless you think this is a bad idea, I would like it done in RealCode.  Is it possible to apply this RealCode condition as a filter? If so, I will need the steps necessary to apply it. 
	If this can't be done as a filter, do I need to apply it as a watchlist column?  I would rather get all the stocks that don't meet this narrow condition completely out of the list right from the start. 
	In advance, thanks.  Richard | 
	|  | 
	
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	The RealCode Condition itself is very straightforward: 
	Writing Conditions in RealCode 
	If Price.Last >= 1.67 * Price.MinLow(5) Then Pass 
	Using the RealCode Condition as a Filter is just a matter of dragging and dropping it to the Filter. A RealCode Condition should work the same as any other Condition. 
	Filtering Lists 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	|  | 
	
	
	|  Registered User
 Joined: 1/20/2005
 Posts: 129
 
 | 
	Hi Bruce,  Your RealCode worked exactly as I asked for.   I reviewed both tutorials, thx.   I now realize my "rookie" mistake.  I need to prevent stocks from being filtered from my watchlist if they've met this condition on any of the most-recent 5 trading days. 
	I also now realize that it doesn't matter how I get the list of 7,800 filtered down.  The important thing is to get it filtered.  Thereby removing stocks from further considreration (resource-consuming processing) that have zero chance of ever making it through my sequence condition.  That said, while I am no longer begging for this to be done in RealCode, that is still my preference (unless that way is a big pain or the alternative is more efficient).  Again, thanks in advance,  Richard | 
	|  | 
	
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	Left-click on the Condition to bring up its Edit window. Then set it to Passing 1 of the Last 5. 
	Doing this will make the Condition check the most recent 5-bars. If the Condition would have returned true on any of those 5-bars, the Condition will return true. 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	|  | 
	
	
	|  Registered User
 Joined: 1/20/2005
 Posts: 129
 
 | 
	Hi Bruce, 
	Update:   After reviewing your suggested reference links, I'm stilll having trouble getting the conditions to be based on daily candles but showing True Markers on an intraday chart.  If I can't figure this out on my own, I'll ask for more help.  I was able to use this condition successfully in my watchlist filter.   I just figured out that  I need to also include this as the first step in my sequence condition which I'm working on simultaneously.  I just wanted to say thanks for getting me pointed in the right direction.  Richard | 
	|  | 
	
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	The RealCode Condition given is based on bars and will use the Bar Interval of the chart for its calculations. It is going to be far more efficient than what I'm going to provide next, so you will probably still want to use it for your WatchList Column. 
	If you want the RealCode Condition to plot on an intraday chart, you might want to try the following RealCode Condition instead however: 
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Up 67% over 5 Day Low
'|******************************************************************
Static DayLow(4) As Single
Static DaysLow As Single
If isFirstBar Then
	For i As Integer = 0 To 4
		DayLow(i) = Single.NaN
	Next
	DaysLow = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
	DaysLow = Single.MaxValue
	For i As Integer = 4 To 1 Step -1
		DayLow(i) = DayLow(i - 1)
		DaysLow = System.Math.Min(DaysLow, DayLow(i))
	Next
	DayLow(0) = Price.Low
	DaysLow = System.Math.Min(DaysLow, Price.Low)
Else
	DayLow(0) = System.Math.Min(DayLow(0), Price.Low)
	DaysLow = System.Math.Min(DaysLow, Price.Low)
End If
If Single.IsNaN(DayLow(4)) Then
	SetIndexInvalid
Else
	If Price.Last >= 1.67 * DaysLow Then
		Pass
	End If
End If 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	|  | 
| Guest-1 |