Registered User Joined: 10/7/2004 Posts: 3
|
I need help in creating two pcf:s
stocks that are within 20% of a new high within 2 months.
And
stocks that have volume on any of the last 10 days exceeding 120% of the prior 20-day volume average.
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
stocks that have volume on any of the last 10 days exceeding 120% of the prior 20-day volume average.
The most efficient way to get this is to count the days since the volume exceeded the 20-day Volume average:
'# period = userinput.integer = 20
'# percentage = userinput.single = 1.2
static barsSince as integer
static exceeded as boolean
if isfirstbar then
barsSince = 0
exceeded = false
endif
if volume.value > volume.avg(period) * percentage then
exceeded = true
barsSince = -1
end if
if exceeded then
barsSince + = 1
end if
plot = count
|