Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Within 25% of all time high Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
turtletrendfollower
Posted : Monday, June 15, 2009 10:22:56 PM
Gold Customer Gold Customer

Joined: 2/27/2005
Posts: 15
Can you please help me write Real Code that will allow me to identify all stocks that are within 25% of thier all time high?


Thanks!
Bruce_L
Posted : Tuesday, June 16, 2009 8:38:36 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Keeping in mind that an "all time high" can only be calculated versus the data used as set under Settings | Data Manager, you might want to try something similar to the following RealCode Rule:

'# Cumulative
Static ATH As Single
If isFirstBar Then
    ATH = Price.High
Else
    If Price.High >= ATH Then
        ATH = Price.High
    End If
End If
If Price.Last / ATH >= .75 Then Pass

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mike From Philly
Posted : Sunday, September 12, 2010 10:37:54 AM
Registered User
Joined: 9/18/2009
Posts: 60
I pulled this oldie but goodie up.   Is there an adaption to this where we can find all stocks that are within 25% of its 5 year high and which works for young stocks like ISLN?
Bruce_L
Posted : Monday, September 13, 2010 9:27:00 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You could try something like the following:

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Within Percent of High
'|******************************************************************
'# Period = UserInput.Integer = 1260
'# Percent = UserInput.single = 25
'# Cumulative
Static Ratio As Single
If isFirstBar Then
    Ratio = 1 - Percent / 100
End If
If Price.Last >= Price.MaxHigh(System.Math.Min(Period, CurrentIndex)) * Ratio Then
    Pass
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mike From Philly
Posted : Monday, September 13, 2010 5:57:31 PM
Registered User
Joined: 9/18/2009
Posts: 60
Bruce, 

Thank you.   I played around with your program and using your CurrentIndex I came up with a different method:

15% of 5 year High On Weekly Chart
 
'# Cumulative
If Price.Last / Price.MaxHigh(System.Math.Min(260, CurrentIndex)) > .85 Then
            Pass
End If
 
 
 
15% of Max High
 
'# Cumulative
If Price.Last / price.MaxHigh(currentindex) > 0.85
            Pass
End If

Its seems to work.
Bruce_L
Posted : Tuesday, September 14, 2010 8:21:19 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
There's no reason it shouldn't work. The math is the same albeit with different settings and the MaxHigh moved to the other side of the inequality. It just isn't adjustable because it doesn't have User Inputs for the settings.

It could probably be sped up some by using the algorithm from my Tuesday, June 16, 2009 8:38:36 AM ET post for the early Bars and switching to Price.MaxHigh once there are enough Bars available.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mike From Philly
Posted : Tuesday, September 14, 2010 5:00:46 PM
Registered User
Joined: 9/18/2009
Posts: 60
......early Bars and switching to Price.MaxHigh once there are enough Bars available .....   

Ahhh, so that is what you were doing.  I couldn't figure out that part.    I haven't noticed any slowness when I flip through the charts with or without those Real Codes.     Thank you for reviewing my work.
Bruce_L
Posted : Tuesday, September 14, 2010 5:06:18 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome. I'm happy to read your current solution is quick enough.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bartolo
Posted : Tuesday, November 16, 2010 9:45:08 AM
Registered User
Joined: 11/4/2010
Posts: 7
Could you please help me write Real Code that will allow me to identify all stocks that are about to reach (25%) of his all time high?


Thanks!
Bruce_L
Posted : Tuesday, November 16, 2010 9:56:39 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
bartolo,
We cannot generally create Conditions to identify what will happen, only what has happened.

My Tuesday, June 16, 2009 8:38:36 AM ET post has a RealCode Condition for identifying symbols that are within 25% of their "all time high" (at least based on the available data being used).

If you have specific unambiguous objective criteria which you believe are indicative of a symbol that is about to reach 25% of its all time high, we may be able to create a Condition for those criteria.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bartolo
Posted : Tuesday, November 16, 2010 12:22:59 PM
Registered User
Joined: 11/4/2010
Posts: 7
Sorry
I will try to explain with an example of CBE Cooper Industries, is a stock wich his All time High is on 7/31/2007 (monthly chart) in 59,05 this month high is 54,48 therefore it will take a 8.4% to reach its all time high.
I would like if it is possible to find all stocks that are for example at a 5%, 10% or 8,4% (like in this example) about to reach its all time high.
Thank you
Bruce_L
Posted : Tuesday, November 16, 2010 12:37:40 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
bartolo,
As stated previously, my Tuesday, June 16, 2009 8:38:36 AM ET post already has a RealCode Condition for identifying symbols that are within 25% of their "all time high" (at least based on the available data being used).

If you want the Percentage to be adjustable, you could use something like the following instead:

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Near All Time High
'|******************************************************************
'# Percent = UserInput.Single = 25
'# Cumulative
Static ATH As Single
Static Ratio As Single
If isFirstBar Then
    ATH = Price.High
    Ratio = 1 - Percent / 100
Else
    If Price.High >= ATH Then
        ATH = Price.High
    End If
End If
If Price.Last / ATH >= Ratio Then Pass

If you want the Percent to be based on the current Price instead of the All Time High, you could reverse the Ratio:

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Near All Time High
'|******************************************************************
'# Percent = UserInput.Single = 25
'# Cumulative
Static ATH As Single
Static Ratio As Single
If isFirstBar Then
    ATH = Price.High
    Ratio = 1 + Percent / 100
Else
    If Price.High >= ATH Then
        ATH = Price.High
    End If
End If
If ATH / Price.Last <= Ratio Then Pass

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bartolo
Posted : Tuesday, November 16, 2010 12:54:20 PM
Registered User
Joined: 11/4/2010
Posts: 7
Thank you Bruce
Bruce_L
Posted : Tuesday, November 16, 2010 12:57:02 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
bartolo,
You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bartolo
Posted : Monday, November 22, 2010 4:31:41 AM
Registered User
Joined: 11/4/2010
Posts: 7
Hello Bruce
Could you Write me (same as above) a RealCode Condition for identifying symbols that are within 25% (adjustable), of their "All time Low" .
And volume bigger than 1.000.000$ (adjustable), (dollars instead of shares).
Thank you very much.
Bruce_L
Posted : Monday, November 22, 2010 10:29:27 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Near All Time Low
'|******************************************************************
'# Percent = UserInput.Single = 25
'# MinDolVol = UserInput.Single = 1000000
'# Cumulative
Static ATL As Single
Static Ratio As Single
If isFirstBar Then
    ATL = Price.Low
    Ratio = 1 + Percent / 100
Else
    If Price.High < ATL Then
        ATL = Price.Low
    End If
End If
If Price.Last / ATL <= Ratio AndAlso _
    100 * Volume.Value * Price.Last > MinDolVol Then Pass

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bartolo
Posted : Monday, November 22, 2010 1:04:16 PM
Registered User
Joined: 11/4/2010
Posts: 7
Thank you
bartolo
Posted : Monday, November 22, 2010 1:13:02 PM
Registered User
Joined: 11/4/2010
Posts: 7

Bruce
I copy and paste the formula and gave me some errors, could you tell me whats wrong
Thank you very much

Bruce_L
Posted : Monday, November 22, 2010 1:16:37 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Certainly not without you providing the error messages you are receiving as the RealCode as posted does not produce any error messages on my computer.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bartolo
Posted : Monday, November 22, 2010 1:23:12 PM
Registered User
Joined: 11/4/2010
Posts: 7
Sorry I did something wrong.
Thank you very much
Bruce_L
Posted : Monday, November 22, 2010 1:33:35 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome. I'm happy to read you were able to figure it out.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.