Average volume code
Author: coley12345
Creation Date: 4/7/2006 8:14 AM
profile picture

coley12345

#1
Hi,

I want to be able to ensure I only pick stocks that at the time of trigger have a 30 day average volume of say 10000 or greater.

CODE:
Please log in to see this code.


But which one of these is correct within the system loop?

CODE:
Please log in to see this code.


or

CODE:
Please log in to see this code.


Also can you tell me why the incorrect one wont work?

Thanks
Dave
profile picture

Cone

#2
The first is correct. VolAv is an randomly-assigned integer variable that represents the 30-period Average Volume SERIES. This integer is only useful for accessing the entire series, whenever a Series variable is required in a WealthScript function.

To access the value at a specific bar, you need to use GetSeriesValue or the @ syntax, i.e. this is also equivalent to the GetSeriesValue statement -
CODE:
Please log in to see this code.

See the WealthScript Language Guide for more details. It's required reading and a good reference if you're programming in WealthScript.
profile picture

coley12345

#3
thanks Cone
profile picture

trader rog

#4
Hi,

I am trying to figure out how to code daily dollar volume (50 day average volume multiplied by the previous day closing price) at the time of the signal. This is what I have currently:

CODE:
Please log in to see this code.


It works correctly for signals in the past few weeks but not for signals generated a year or two ago. It seems to be the same issue that coley was having above but when I tried the fix that Cone suggested, it didn't change anything. I am using version 6.1 so not sure if that is why. Please help.
profile picture

Eugene

#5
Cone's suggestion applied to a different program version (WL4) with a different language (Pascal). Moving the discussion from the old WL4 forums to the new.

On the surface, the limited code snippet above does not make it possible to understand what is going wrong. Please post more code demonstrating how you're using it, as well as provide an example where you think it fails (symbol, data provider etc.)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).