StockFetcher Forums · General Discussion · filtering average volatility<< >>Post Follow-up
jchariton
1 posts
msg #162032
Ignore jchariton
11/19/2025 8:24:31 AM

Looking for help creating a filter that will give me stocks that:
yesterdays close is > 2x average daily price volatility
average volume > 1 millions shares per day
at least second consecutive day of this criteria

I started with this and am getting an error I can't fix - any ideas?
/* --- DEFINE AVERAGE DAILY % VOLATILITY --- */
set{avg_vol_pct, ( atr(20) / close ) * 100}

/* --- YESTERDAY'S % MOVE --- */
set{pct_move_yest, abs(close 1 day ago / close 2 days ago - 1) * 100}

/* --- 5× VOLATILITY THRESHOLD --- */
set{threshold, avg_vol_pct * 2}

/* --- FILTER: YESTERDAY'S MOVE > 5× VOLATILITY --- */
pct_move_yest > threshold

xarlor
625 posts
msg #162033
Ignore xarlor
11/19/2025 9:46:32 AM

Oof, buddy. You got hit by a double whammy of SF syntax peculiarities:

1. SF can only do 1 operation per line. If you subtract something and divide in the same line, SF breaks. Split each operation into its own line.
2. abs() takes a single value. You cannot do an operation within it. Do all operations in prior lines, then take the single resulting value and put it in abs().

Here is the filter you posted in working form:

Fetcher[
/* DEFINE AVERAGE DAILY PERCENT VOLATILITY */
set{avg_vol_pct1,atr(20) / close}
set{avg_vol_pct,avg_vol_pct1 * 100}

/* YESTERDAY'S PERCENT MOVE */
set{pct_move_yest1,close 1 day ago / close 2 days ago}
set{pct_move_yest2,pct_move_yest1 - 1}
set{pct_move_yest3,abs(pct_move_yest2)}
set{pct_move_yest,pct_move_yest3 * 100}

/* 5x VOLATILITY THRESHOLD */
set{threshold,avg_vol_pct * 2}

/* FILTER: YESTERDAY'S MOVE more than 5x VOLATILITY */
pct_move_yest > threshold

add column pct_move_yest
add column threshold
]



Now, to your original intent, I'm not understanding what your goal is.

"yesterdays close is > 2x average daily price volatility"

This is comparing the ticker's price with its (high - low) value. The two do not correlate. A ticker trading at $5 or more is always going to be higher than its trading range. Can you explain what you're going for in more detail?



StockFetcher Forums · General Discussion · filtering average volatility<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.