Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Up Down Volume Indicator Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
sagomez66
Posted : Sunday, October 10, 2010 6:19:17 PM
Registered User
Joined: 7/16/2006
Posts: 41
I'm trying to create a simple Up Down Volume indicator for an index. 

I'd like it to start at zero for the start of the day and then simply Add the volume for the time period of the chart(5 min, 10 min whatever) to the current sum or subtract the volume from the current sum and plot the line. 

So for example - if it's 9:30 start at 0, at 9:45 if the price is above where it was at 9:30 and the volume was 100 shares then value would be 100, if at 10:00 the price is below where it was at 9:45 and the volume was 500 shares then the value would be -400

Here is the code I have so far:

Static Sum(1) As Single
If isFirstBar Then
    Sum(1) = 0
Else
    If Price.Last > Price.Last(1) Then
        Sum(1) = sum(1) + Volume.Value
    Else
        sum(1) = sum(1) - Volume.Value
    End If

End If

Plot = Sum(1)

Any help would be appreciated...
Bruce_L
Posted : Monday, October 11, 2010 12:13:09 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Up Down Volume
'|******************************************************************
Static Sum As Single
If isFirstBar Then
    Sum = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
    Sum = 0
Else
    If Price.Last > Price.Last(1) Then
        Sum += Volume.Value
    Else
        Sum -= Volume.Value
    End If
End If
Plot = Sum

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
sagomez66
Posted : Tuesday, October 12, 2010 10:28:31 AM
Registered User
Joined: 7/16/2006
Posts: 41
Great Bruce.  Thank you for the quick reply!
Bruce_L
Posted : Tuesday, October 12, 2010 10:39:08 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
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.