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 |

moving average of down day only volume (or up day)? Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
wpalermo
Posted : Saturday, March 12, 2011 12:08:16 PM
Registered User
Joined: 5/4/2010
Posts: 18
Anybody have a way of plotting a moving average of volume on days when close is lower than previous close(ignoring volume on up days) and vice versa. 
I would like to have a userinput to adjust the length of the MA.
Bruce_L
Posted : Monday, March 14, 2011 8:33:51 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Do you want the Moving Average of Down Volume within a certain number of Period x Bars or do you want the Moving Average of Volume for the most recent Period x Down Bars?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
wpalermo
Posted : Wednesday, March 23, 2011 4:28:33 PM
Registered User
Joined: 5/4/2010
Posts: 18
Hi Bruce, I'm not sure I understand your question. Example:
x's are down days, o's are up (price)

XOXOXOXOXXXOOXX

I want the MA of the volume on the X days only. I am not sure how I want to handle the O days, probably just let MA go flat if it hits a string of O's but not drop.
Thanks
Bruce_L
Posted : Wednesday, March 23, 2011 4:47:58 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Let's say you have a 15-Period version of the Indicator (I chose 15 because there are 15 characters in your example).

Do you want to just include all the X Bars during the most recent 15-Bars (9 of the 15-Bars in your example):

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:MA of Down Volume in Bars
'|******************************************************************
'# Period = UserInput.Integer = 15
Static Sum As Single
Static Count As Integer
If isFirstBar Then
    Sum = 0
    Count = 0
Else If Price.Last < Price.Last(1) Then
    Sum += Volume.Value
    Count += 1
End If
If CurrentIndex > Period AndAlso _
    Price.Last(Period) < Price.Last(Period + 1) Then
    Sum -= Volume.Value(Period)
    Count -= 1
End If
If CurrentIndex >= Period Then
    If Count > 0 Then
        Plot = Sum / Count
    Else
        Plot = Single.NaN
    End If
Else
    Plot = Single.NaN
End If

Or do you want to include the most recent 15-Down Bars no matter how far you need to go back to get those 15-Down Bars?

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:MA of Down Volume Bars
'|******************************************************************
'# Period = UserInput.Integer = 15
Static Sum As Single
Static Past As New List(Of Single)
If isFirstBar Then
    Sum = 0
    Past.Clear
Else If Price.Last < Price.Last(1) Then
    Sum += Volume.Value
    Past.Add(Volume.Value)
End If
If Past.Count = Period Then
    Plot = Sum / Period
    Sum -= Past(0)
    Past.RemoveAt(0)
Else
    Plot = Single.NaN
End If
If isLastBar Then
    Past.Clear
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
wpalermo
Posted : Wednesday, March 23, 2011 9:30:28 PM
Registered User
Joined: 5/4/2010
Posts: 18

I guess I will try it both ways, that question never even popped into my head.
You're awesome dude.
Thanks

Bruce_L
Posted : Thursday, March 24, 2011 8:18:31 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Do you want to try making the Up Volume versions on your own or do you need the RealCode for those as well?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
wpalermo
Posted : Thursday, March 24, 2011 7:59:18 PM
Registered User
Joined: 5/4/2010
Posts: 18
I will modify them as needed. (I think)
Thanks again.
Bruce_L
Posted : Friday, March 25, 2011 9:30:27 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome. We'll be here if you run into any problems making the modifications.

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