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 |

Recent Highs Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
andrepare
Posted : Monday, April 11, 2011 5:49:05 AM
Registered User
Joined: 12/26/2009
Posts: 50
Hi Bruce,
I would like to be able to scan for recent highs.
- The stocks that made a new 20-day high in the last 10 days.
They might be trading lower today but if they made a new 20-day high in the last 10 days, I want to be able to find them.
Thanks,
Bruce_L
Posted : Monday, April 11, 2011 8:10:23 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try using the following RealCode Condition with the Period set to 19, and Passing 1 of the Last 10 with a Daily Bar Interval:

Writing Conditions in RealCode

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:New High
'|******************************************************************
'# Period = UserInput.Integer = 19
If Price.High > Price.MaxHigh(Period, 1) Then
    Pass
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jas0501
Posted : Monday, April 11, 2011 10:56:33 AM
Registered User
Joined: 12/31/2005
Posts: 2,499
QUOTE (andrepare)
Hi Bruce,
I would like to be able to scan for recent highs.
- The stocks that made a new 20-day high in the last 10 days.
They might be trading lower today but if they made a new 20-day high in the last 10 days, I want to be able to find them.
Thanks,


'# shortPeriod = userInput..integer = 10
'# longPeriod = userinput.integer = 20
if  Price.MaxHigh(shortPeriod) = Price.MaxHigh(longPeriod) then
  pass
end if
Bruce_L
Posted : Monday, April 11, 2011 11:16:57 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
It should probably be noted that while the results of jas0501 RealCode Condition will frequently match the results of the RealCode Condition I provided, they will not always do so.

The reason being that jas0501's version is not checking for New Highs and it is not checking to see if it was a High at the time it was made, it is only checking if there is a High during the short Period that is at least equal to the current Long Period High. This is certainly a legitimate thing for which to search (and may even match the intent of your question), but does not represent a literal interpretation of your original request.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jas0501
Posted : Monday, April 11, 2011 2:36:59 PM
Registered User
Joined: 12/31/2005
Posts: 2,499
QUOTE (Bruce_L)
It should probably be noted that while the results of jas0501 RealCode Condition will frequently match the results of the RealCode Condition I provided, they will not always do so.

The reason being that jas0501's version is not checking for New Highs and it is not checking to see if it was a High at the time it was made, it is only checking if there is a High during the short Period that is at least equal to the current Long Period High. This is certainly a legitimate thing for which to search (and may even match the intent of your question), but does not represent a literal interpretation of your original request.


I beg to differ. The original request was 

The stocks that made a new 20-day high in the last 10 days.

and my code does just that.
 
If the max high over the last ten days matches the max high over the last 20 days then pass.

If the 20 day high is 100, the 10 day high can only be
 1. equal to
 2. less than the 20 day high

It can't be greater as this would be a new 20 day high.
Bruce_L
Posted : Monday, April 11, 2011 2:58:13 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
jas0501,
Let us for a moment examine McDonalds Corp (MCD) as an example on a Daily Chart even though the analysis might change if the most recent Daily (4/11/2011) Bar ends up breaking the 20-Bar High being used at the time of this posting for the example.

MCD currently returns True for your version because 4/6/2011 has the highest High in the most recent 10-Trading Days and it is also the High of the most recent 20-Trading Days. There is absolutely nothing wrong with identifying this returning True if that is what you want. It may even be what andrepare does want to identify.

That said, 4/6/2011 does not represent a New 20-Day High at all. On 4/6/2011, the 20-Day High was actually on 3/10/2011. The high of 4/6/2011 did not become the 20-Day High until 4/8/2011 (and by then, it certainly isn't a New High).

MCD returns True for your formula, but MCD does not satisfy the literal terms of the original request.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jas0501
Posted : Monday, April 11, 2011 4:31:18 PM
Registered User
Joined: 12/31/2005
Posts: 2,499
QUOTE (Bruce_L)
jas0501,
Let us for a moment examine McDonalds Corp (MCD) as an example on a Daily Chart even though the analysis might change if the most recent Daily (4/11/2011) Bar ends up breaking the 20-Bar High being used at the time of this posting for the example.

MCD currently returns True for your version because 4/6/2011 has the highest High in the most recent 10-Trading Days and it is also the High of the most recent 20-Trading Days. There is absolutely nothing wrong with identifying this returning True if that is what you want. It may even be what andrepare does want to identify.

That said, 4/6/2011 does not represent a New 20-Day High at all. On 4/6/2011, the 20-Day High was actually on 3/10/2011. The high of 4/6/2011 did not become the 20-Day High until 4/8/2011 (and by then, it certainly isn't a New High).

MCD returns True for your formula, but MCD does not satisfy the literal terms of the original request.


No, not a New Hgh but a New 20 Day Hgh

On 4/8/11 the New 20 day High was the high of 4/6/11. So it  made a new 20-day high in the last 10 days. It wasn't the 20 day high when it occurred on 4/6/11 but it became a new 20 day high on 4/8/11 when the 3/10/11 20 day high expired.




StockGuy
Posted : Monday, April 11, 2011 4:50:34 PM

Administration

Joined: 9/30/2004
Posts: 9,187
I would interpret as Bruce does that it has to be a new 20-day on on the day the action took place.
jas0501
Posted : Monday, April 11, 2011 8:03:35 PM
Registered User
Joined: 12/31/2005
Posts: 2,499
QUOTE (StockGuy)
I would interpret as Bruce does that it has to be a new 20-day on on the day the action took place.


Then MCD doesn't have a new 20 day high in the last ten day enven though the maxHigh(20) = the same price as 4/6/11 on 4/11/11?

Then with the "alternate" interpretations the code would be

'# shortPeriod = userinput.integer = 10
'# longPeriod = userinput.integer = 20
static count as integer 

if isfirstbar then 
   count = -1
end if

if currentindex > longPeriod then
  if price.high > price.maxhigh(longPeriod - 1, 1)  then
    count = 0
  else
    count += 1
  end if
  if count >= 0 and count < shortPeriod then
     pass
  end if
end if
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.