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 |

Uptrending Pullback Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Mully
Posted : Tuesday, March 2, 2010 8:37:20 AM
Registered User
Joined: 10/7/2004
Posts: 91
Would it be possible to get a realcode SF-5 scan for stocks in a 15 day  uptrend followed by a 2 to 3 day pullback.  Stocks priced < 25 with a 5 day avg vol > 200k
Bruce_L
Posted : Tuesday, March 2, 2010 9:41:00 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
What do you see as a 15-Day Uptrend? Does the Net Change for each of those 15-Days need to be positive? Does it just need to have a positive Linear Regression Slope and/or Net Change over those 15-Days? Something else entirely?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mully
Posted : Tuesday, March 2, 2010 9:51:02 AM
Registered User
Joined: 10/7/2004
Posts: 91
Sorry I didnt make it clearer Bruce and thanks for the reply, it just needs to have a positive upward slope. A net change > 15% over the 15 days would also be helpful
Bruce_L
Posted : Tuesday, March 2, 2010 11:13:06 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following RealCode Condition:

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Uptrending Pullback
'|******************************************************************
Static Sum As Single
Static Slope As Single
Static Past(3) As Boolean
Static Count As Integer
If isFirstBar Then
    Sum = 0
    Slope = 0
    Count = 0
Else
    If Price.Last < Price.Last(1) Then
        Count += 1
    Else
        Count = 0
    End If
End If
Sum += Price.Last
If CurrentIndex >= 16 Then
    Sum -= Price.Last(16)
    Slope += 7.5 * Price.Last(16)
End If
Slope += 8.5 * Price.Last - Sum
Past(3) = Past(2)
Past(2) = Past(1)
Past(1) = Past(0)
If Slope > 0 Then
    Past(0) = True
End If
If CurrentIndex >= 18 Then
    If (Price.PercentChange(15, 2) >= 15 AndAlso _
        Price.Last(2) = Price.MaxClose(16, 2) AndAlso _
        Past(2) = True AndAlso _
        Count = 2) OrElse _
        (Price.PercentChange(15, 3) >= 15 AndAlso _
        Price.Last(3) = Price.MaxClose(16, 3) AndAlso _
        Past(3) = True AndAlso _
        Count = 3) Then
        Pass
    End If
Else
    SetIndexInvalid
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mully
Posted : Tuesday, March 2, 2010 11:20:23 AM
Registered User
Joined: 10/7/2004
Posts: 91
worked great, tnx Bruce
Bruce_L
Posted : Tuesday, March 2, 2010 11:21:13 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome. I was worried that it might be too restrictive.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mully
Posted : Tuesday, March 2, 2010 12:12:55 PM
Registered User
Joined: 10/7/2004
Posts: 91
no this setup is fine, but if I wanted to change the 15+ day uptrend to say 10 do I just change all the 16's in your formula to 11 ?.....................tia
Bruce_L
Posted : Tuesday, March 2, 2010 12:27:32 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Yes. Just change all of the 15s (with the possible exception of those specifying the size of the Percent Change) to 10s and all of the 16s to 11s.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mully
Posted : Wednesday, March 3, 2010 4:25:06 PM
Registered User
Joined: 10/7/2004
Posts: 91

I'm not seeing it with the uptrend pullback scan, is there anyway to use the smith scan (listed below) followed by  a one to three day pullback



Static Count As Integer
If isFirstBar Then
    Count = 0
Else If Price.Last >= 1.15 * Price.Last(1) Then
    Count += 1
End If
If CurrentIndex >= 7 AndAlso _
    Price.Last(6 ) >= 1.15 * Price.Last(7) Then
    Count -= 1
End If
If CurrentIndex >= 49 Then
    If Count >= 1 AndAlso _
        1.5 <= Price.Last AndAlso _
        Price.Last <= 12 AndAlso _
        Volume.AVG(50) >= 1000 Then
        Pass
    End If
Else
    SetIndexInvalid
End If

Bruce_L
Posted : Wednesday, March 3, 2010 4:54:58 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 4.9 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Smith Scan with Pullback
'|******************************************************************
Static Count(1) As Integer
Static Past(3) As Boolean
If isFirstBar Then
    Count(0) = 0
    Count(1) = 0
Else
    If Price.Last >= 1.15 * Price.Last(1) Then
        Count(0) += 1
    End If
    If Price.Last < Price.Last(1) Then
        Count(1) += 1
    Else
        Count(1) = 0
    End If
End If
If CurrentIndex >= 7 AndAlso _
    Price.Last(6 ) >= 1.15 * Price.Last(7) Then
    Count(0) -= 1
End If
Past(3) = Past(2)
Past(2) = Past(1)
Past(1) = Past(0)
If CurrentIndex >= 49 Then
    If Count(0) >= 1 AndAlso _
        1.5 <= Price.Last AndAlso _
        Price.Last <= 12 AndAlso _
        Volume.AVG(50) >= 1000 Then
        Past(0) = True
    Else
        Past(0) = False
    End If
End If
If CurrentIndex >= 52 Then
    If (Past(1) = True AndAlso _
        Count(1) >= 1) OrElse _
        (Past(2) = True AndAlso _
        Count(1) >= 2) OrElse _
        (Past(3) = True AndAlso _
        Count(1) >= 3) Then
        Pass
    End If
Else
    SetIndexInvalid
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mully
Posted : Wednesday, March 3, 2010 5:00:23 PM
Registered User
Joined: 10/7/2004
Posts: 91
that works much better, thanks Bruce
Bruce_L
Posted : Thursday, March 4, 2010 9:41:28 AM


Worden Trainer

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

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jimnh73
Posted : Tuesday, June 1, 2010 12:07:25 AM
Registered User
Joined: 8/26/2008
Posts: 14
Bruce,
Can you clarify the slope calculation from the first example, eg:
Sum += Price.Last
If CurrentIndex >= 16 Then
    Sum -= Price.Last(16)
    Slope += 7.5 * Price.Last(16)
End If
Slope += 8.5 * Price.Last - Sum

I'm not grasping why 7.5 or 8.5....
Is this an easy way to calc the slope of a 15 day lin reg? (in which case if the number of days is changed from 15 dont the multipliers have to change?)
Thanks
-jim
Bruce_L
Posted : Tuesday, June 1, 2010 10:38:39 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
jimnh73,
The Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis topic explains the basic calculations used to calculate a Linear Regression Slope (or endpoint).

The reason it is done the way it is in the RealCode is so that it doesn't have to loop to calculate the Moving Average and Linear Regression Slope at each data point (this should speed things up considerably compared to a loop based algorithm). The 7.5 and 8.5 are just (Period - 1) / 2 and (Period + 1) / 2.

My Tuesday, May 11, 2010 9:03:09 AM ET post in Linear Regression Slope Real code has RealCode for the Linear Regression Slope with an adjustable Period.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jimnh73
Posted : Tuesday, June 1, 2010 12:03:58 PM
Registered User
Joined: 8/26/2008
Posts: 14
Excellent; Thank you Bruce
Bruce_L
Posted : Tuesday, June 1, 2010 12:12:29 PM


Worden Trainer

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

-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.