Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
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...
|
|
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
|
|
Registered User Joined: 7/16/2006 Posts: 41
|
Great Bruce. Thank you for the quick reply!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |