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 |

Above Average Volume Topic Rating:
Previous Topic · Next Topic Watch this topic · Print this topic ·
karsat
Posted : Monday, April 27, 2009 12:51:29 PM
Registered User
Joined: 3/10/2009
Posts: 5
Hi,

I am looking for setting up a scan which shows me the list of stocks trading N times above the average volume(30 day average) for this time of the day...(day being prorated)

Thank you very much for your help
Bruce_L
Posted : Monday, April 27, 2009 1:34:44 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I've created a Cumulative Intraday Vol Surge RealCode Indicator (you need to have Settings | Data Manager | Number of Intraday Bars set high enough to calculate the Moving Average for it to work). You can right-click on the Indicator and select Create Rule to create a Rule for use as a Watchlist Light or in a Filter. You should be able to replace everything below the Inherits line in the Class tab of a RealCode Indicator with the following to create the RealCode Indicator:

    '# Period = UserInput.Integer = 30
    Sub New
        AutoLoop = False
    End Sub
    Public Overrides Function Plot() As System.Single
        If TimeFrame.TotalDays <= 1 AndAlso Period >= 2 Then
            Dim Start(Period-1) As Integer
            Dim DayCount As Integer = -1
            Dim BarCount As Single = 0
            Dim Sum(1) As Single
            Dim SMA As New System.Collections.Generic.List(Of Single)
            For i As Integer = 1 To Volume.Line.Count - 1
                If Volume.Line.DateValue(i).DayOfYear <> Volume.Line.DateValue(i - 1).DayOfYear Then
                    DayCount += 1
                    BarCount = 0
                    Sum(0) = 0
                    Sum(1) = 0
                    If DayCount >= Period Then
                        Dim j As Integer = 0
                        For k As Integer = Start(DayCount Mod Period) To Start((DayCount + 1) Mod Period) - 1
                            SMA(j) -= Volume.Line.Value(k )
                            j += 1
                        Next
                    End If
                    Start(DayCount Mod Period) = i
                End If
                If DayCount >= 0 Then
                    If BarCount >= SMA.Count Then
                        SMA.Add(Volume.Line.Value(i))
                    Else
                        SMA(BarCount) += Volume.Line.Value(i)
                    End If
                End If
                If DayCount >= Period - 1 Then
                    Sum(0) += Volume.Line.Value(i)
                    Sum(1) += SMA(BarCount)
                    If Sum(1) > 0 Then
                        AddToOutput(Volume.Line.DateValue(i), Sum(0) / (Sum(1) / Period))
                    End If
                End If
                BarCount += 1
            Next
        End If
    End Function
End Class

I've also created a Culumulative Intraday Vol Surge RealCode Condition if you would prefer not to create the RealCode Indicator and then use Drag and Drop to create the Condition. You should be able to replace everything below the Inherits line in the Class tab of a RealCode Condition with the following to create the RealCode Condition:

    '# Period = UserInput.Integer = 30
    '# MinSurge = UserInput.Single = 3
    Sub New
        AutoLoop = False
    End Sub
    Public Overrides Sub CallUserCode()
        If TimeFrame.TotalDays <= 1 AndAlso Period >= 2 Then
            Dim Start(Period-1) As Integer
            Dim DayCount As Integer = -1
            Dim BarCount As Single = 0
            Dim Sum(1) As Single
            Dim SMA As New System.Collections.Generic.List(Of Single)
            For i As Integer = 1 To Volume.Line.Count - 1
                If Volume.Line.DateValue(i).DayOfYear <> Volume.Line.DateValue(i - 1).DayOfYear Then
                    DayCount += 1
                    BarCount = 0
                    Sum(0) = 0
                    Sum(1) = 0
                    If DayCount >= Period Then
                        Dim j As Integer = 0
                        For k As Integer = Start(DayCount Mod Period) To Start((DayCount + 1) Mod Period) - 1
                            SMA(j) -= Volume.Line.Value(k )
                            j += 1
                        Next
                    End If
                    Start(DayCount Mod Period) = i
                End If
                If DayCount >= 0 Then
                    If BarCount >= SMA.Count Then
                        SMA.Add(Volume.Line.Value(i))
                    Else
                        SMA(BarCount) += Volume.Line.Value(i)
                    End If
                End If
                If DayCount >= Period - 1 Then
                    Sum(0) += Volume.Line.Value(i)
                    Sum(1) += SMA(BarCount)
                    If Sum(1) > 0 Then
                        If Sum(0) / (Sum(1) / Period) >= MinSurge Then
                            AddToOutput(Volume.Line.DateValue(i), True)
                        Else
                            AddToOutput(Volume.Line.DateValue(i), False)
                        End If
                    End If
                End If
                BarCount += 1
            Next
        End If
    End Sub
End Class

It should probably be noted that both the RealCode Indicator and the RealCode Condition are quite computationally intensive and require a lot of data to calculate for a 30-Day Moving Average when the Time Frame is short. Calculating for an entire Watchlist as would be done with a Filter or Sort could take quite some time (especially if the Watchlist is large).

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
karsat
Posted : Monday, April 27, 2009 1:51:15 PM
Registered User
Joined: 3/10/2009
Posts: 5
The realcode rule is failing due to complication errors as below

Public override Sub CallUser code has multiple definitions with identical signatures
and some other errors
Bruce_L
Posted : Monday, April 27, 2009 2:02:49 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I get the error message you describe if I replace everything below the Public Overrides line in the Class tab of the RealCode Editor of a RealCode Condition instead of everything below the Inherits line (this creates two identical Public Overrides lines at different points in the RealCode).

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
karsat
Posted : Monday, April 27, 2009 2:51:13 PM
Registered User
Joined: 3/10/2009
Posts: 5
Thanks it worked...

1.How is it different from Volume Surge?
2. Is there a way to scan for stocks whose 30 day average volume > 1Million

Thanks
Bruce_L
Posted : Monday, April 27, 2009 3:27:03 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
It's different from the normal Volume Surge in that it calculates the Average Volume up to this point in the day. A normal Volume Surge is just going to compare the Average Volumes over the number of Bars specified in their settings.

The normal way to check for 30-Day Average Volume would be to add a 30-Period Simple Moving Average of Volume to a Daily Chart and then right-click on it and select Create Rule | Greater Than Value | 10000 (Volume in StockFinder is normally reported in blocks of 100 shares).

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
karsat
Posted : Monday, April 27, 2009 5:33:45 PM
Registered User
Joined: 3/10/2009
Posts: 5
Please let me know how I can order by the highest above than average volume  descending
Bruce_L
Posted : Tuesday, April 28, 2009 8:08:07 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Drag and Drop the RealCode Indicator given in my Monday, April 27, 2009 1:34:44 PM ET post to the Watchlist and select Raw Value. Then left-click on the Watchlist Column Header to use it as a Sort. It defaults to descending order on my computer, but if that is not the case, left-click on the Watchlist Column Header again to reverse the order.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
thnkbigr
Posted : Wednesday, December 1, 2010 4:55:12 PM
Platinum Customer Platinum Customer

Joined: 3/31/2006
Posts: 3,207
Bruce to plot your RC in your Monday, April 27, 2009 1:34:44 PM do I need to be on Daily chart or Intraday?
Bruce_L
Posted : Wednesday, December 1, 2010 4:58:59 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
They are both Intraday. I think they would probably degrade gracefully into a Daily Bar Interval, but then they wouldn't provide any advantages over the standard Volume Surge (while probably continuing to remain slower).

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
chrfiala76
Posted : Wednesday, June 1, 2011 10:48:59 AM
Registered User
Joined: 8/19/2010
Posts: 40
Hi Bruce,

i just implemented this indicator and want to use it in a filter, but run into some problems.

is it possible to fix the calculation basis for this indicators, no matter what the chart time frame is?

eg, i want to calculate the first indicator always on either the 5min bars or the 15min bars, so i could keep the chart on a daily and still see the id volume or use it as filter still working with daily charts.

your help is appreciated
Bruce_L
Posted : Wednesday, June 1, 2011 12:56:27 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You could add a Volume with Bar Interval Indicator to the Chart, adjust it to the desired Bar Interval and then replace everything below the Inherits line in the Class tab of a RealCode Indicator with the following to create the RealCode Indicator (the charted Volume with Bar Interval must be exactly called Volume with Bar Interval, it can't have a .2 or anything after it unless that is also done in the RealCode):

    '# VwBI = chart.VolumewithBarInterval
    '# Period = UserInput.Integer = 30
    Sub New
        AutoLoop = False
    End Sub
    Public Overrides Function Plot() As System.Single
        If Period >= 2 Then
            Dim Start(Period-1) As Integer
            Dim DayCount As Integer = -1
            Dim BarCount As Single = 0
            Dim Sum(1) As Single
            Dim SMA As New System.Collections.Generic.List(Of Single)
            For i As Integer = 1 To VwBI.Line.Count - 1
                If VwBI.Line.DateValue(i).DayOfYear <> VwBI.Line.DateValue(i - 1).DayOfYear Then
                    DayCount += 1
                    BarCount = 0
                    Sum(0) = 0
                    Sum(1) = 0
                    If DayCount >= Period Then
                        Dim j As Integer = 0
                        For k As Integer = Start(DayCount Mod Period) To Start((DayCount + 1) Mod Period) - 1
                            SMA(j) -= VwBI.Line.Value(k )
                            j += 1
                        Next
                    End If
                    Start(DayCount Mod Period) = i
                End If
                If DayCount >= 0 Then
                    If BarCount >= SMA.Count Then
                        SMA.Add(VwBI.Line.Value(i))
                    Else
                        SMA(BarCount) += VwBI.Line.Value(i)
                    End If
                End If
                If DayCount >= Period - 1 Then
                    Sum(0) += VwBI.Line.Value(i)
                    Sum(1) += SMA(BarCount)
                    If Sum(1) > 0 Then
                        AddToOutput(VwBI.Line.DateValue(i), Sum(0) / (Sum(1) / Period))
                    End If
                End If
                BarCount += 1
            Next
        End If
    End Function
End Class

You should be able to Open an attached Indicator directly into a running copy of StockFinder 5 (and save it from within StockFinder 5 if desired). You could also Save it to the \My Documents\StockFinder5\(Your Username)\My Indicators\ folder and then load it like you would any other Indicator (or Copy and Paste it there from wherever it Saves if you can't specify the destination directory when Saving).

Attachments:
Volume with Bar Interval.sfInd - 18 KB, downloaded 1,054 time(s).



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
chrfiala76
Posted : Friday, June 3, 2011 10:25:58 AM
Registered User
Joined: 8/19/2010
Posts: 40
QUOTE (Bruce_L)
You could add a Volume with Bar Interval Indicator to the Chart, adjust it to the desired Bar Interval and then replace everything below the Inherits line in the Class tab of a RealCode Indicator with the following to create the RealCode Indicator (the charted Volume with Bar Interval must be exactly called Volume with Bar Interval, it can't have a .2 or anything after it unless that is also done in the RealCode):


i did that, it also works perfectly when i work on the 5min/15min/30min charts; so it shows the cummulative volume today compared to the last days.

as soon as i switch to the daily chart, it stops working and basically takes the todays volume vs the avg volume of the last x days.

so basically i would like to have the indicator calulcated like in the 5min/15min/30min chart, but displayed it on the daily chart. what i would need to do is to tell the indicator that it shall not work on the time frame which i set the chart on, but always use the time frame X.

is this possible?
Bruce_L
Posted : Friday, June 3, 2011 10:37:22 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
The original RealCode Indicator from my Monday, April 27, 2009 1:34:44 PM ET post behaves as you describe.

Following the directions in my Wednesday, June 01, 2011 12:56:27 PM ET post should create an Indicator with a Bar Interval which can be set in the Volume with Bar Interval Indicator (or in the Volume Surge Indicator itself if the Volume with Bar Interval Indicator is removed from the Chart after the Volume Surge Indicatar is created).

Attachments:
Intraday VS with Bar Interval.sfIndRC - 8 KB, downloaded 960 time(s).



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
chrfiala76
Posted : Tuesday, June 7, 2011 10:10:08 AM
Registered User
Joined: 8/19/2010
Posts: 40

Hi Bruce,

ty, the last indicator seems to do exactly what i was looking for, unfortunately it has a "side effect" - it messes up the chart window. so altough i have set the chart window. i tried to get behind to code to use "15min" as calculation basis but "daily"/the chart setting as display basis. but it seems to be above my skill leve. not sure it is even possible.

http://i56.tinypic.com/fdtte1.jpg

Bruce_L
Posted : Tuesday, June 7, 2011 10:20:48 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I'm not sure if this is what you want or not, but you could output the results only on the last Bar of the data or the last Bar of a Day. To do so, change:

                AddToOutput(VwBI.Line.DateValue(i), Sum(0) / (Sum(1) / Period))

To:

                If isLastBar OrElse _
                    VwBI.Line.DateValue(i).DayOfYear <> _
                    VwBI.Line.DateValue(i + 1).DayOfYear Then
                    AddToOutput(VwBI.Line.DateValue(i), Sum(0) / (Sum(1) / Period))
                End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
brakkar
Posted : Wednesday, October 19, 2011 5:11:56 AM
Registered User
Joined: 1/25/2005
Posts: 39
So if I interpret correctly (about first indicator posted on monday 27 up there) an indicator reading of 1.25 at 11:15 Am means that from 9:30 to 11:15, volume is 25% greater than volume from 9:30 to 11:15 on average for the latest XX days ?
Bruce_L
Posted : Wednesday, October 19, 2011 8:15:56 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Your interpretation is correct.

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