Registered User Joined: 1/14/2006 Posts: 436
|
Bruce
A second request for realcode to count for the number of bars (daily or 5 minute) since:
1. Current stock price crosses from above to below prior days or prior bar High.
Count = number of bars since occurrence (positive numbers).
2. Current stock price crosses from below to above prior days or prior bar Low.
Count = number of bars since occurrence (negative numbers)
Thanks ... Dan
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Maybe the following for 1?
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Since xDn High
'|******************************************************************
Static Count As Single
If isfirstBar Then
Count = Single.NaN
Else If Price.High > Price.High(1) AndAlso _
Price.Last < Price.High(1) Then
Count = 0
Else
Count += 1
End If
Plot = Count
And the following for 2?
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Since xUp Low
'|******************************************************************
Static Count As Single
If isfirstBar Then
Count = Single.NaN
Else If Price.Low < Price.Low(1) AndAlso _
Price.Last > Price.Low(1) Then
Count = 0
Else
Count -= 1
End If
Plot = Count
-Bruce Personal Criteria Formulas TC2000 Support Articles
|