Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/13/2005 Posts: 20
|
I have a stock list and I want to filter/scan the list for those stocks which have higher volume for that time of day. In other words I want to compare the current volume for today to the average volume for the same time of day. Is there a way to do that? I was trying to come up with an indicator which uses "volume.last" and "Me.currentdate.hour/minute" etc. but was not successful. May be it is not possible?
|
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The Above Average Volume topic has both an Intraday Volume Surge Indicator and an Intraday Volume Surge Rule that can be used to compare the current Volume up until that point in the day to the average volume up until that point of the day.
You need to have Settings | Data Manager | Number of Intraday Bars set high enough to calculate the Moving Average for them to work.
You should be able to replace everything below the Inherits line in the Class tab of a RealCode Indicator with the following to create a non-Cumulative version of the RealCode Indicator (which appears to be what you are describing):
'# 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 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
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
If SMA(BarCount) > 0 Then
AddToOutput(Volume.Line.DateValue(i), Volume.Line.Value(i) / (SMA(BarCount) / Period))
End If
End If
BarCount += 1
Next
End If
End Function
End Class
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/13/2005 Posts: 20
|
Hi Bruce,
Thanks for your help. I'll try your real code. One question though.. Bar can be 5 min or 15min, in other words can I use 5 min or 15 chart?
|
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The RealCode doesn't care what Time Frame is being used. It's designed for Intraday Time Frames, but 1-Day and longer Time Frames should just degrade into a standard Volume Surge Indicator.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/13/2005 Posts: 20
|
Hi Bruce,
Thanks for the response. Now I have another question. I have data manager setting at 500 intraday bars (I am using 5min intraday chart). Is that good enough?
|
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It depends on your Time Frame and the Period of your moving Average. There are 390 1-Minute Bars in a Day, so you are going to need close to 4000-Bars of data to Plot even a 10-Period version on a 1-Minute Chart. But there are only 7 1-Hour Bars in a Day.
You can do the math if you want, but it really is just easier to try and Plot it. If it doesn't Plot, you don't have enough data for your settings.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/13/2005 Posts: 20
|
OK, Now I understand. Thanks for your help.
|
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |