| DMOBRIEN 381 posts
 msg #161891
 - Ignore DMOBRIEN
 | 7/20/2025 9:07:21 AM 
 Made this yesterday.  It's designed to catch pre breakout opportunities, has a redundancy or two, but looks really sharp in the results it produces.  Trying to capture expansion from Accumulation/Distribution compression where the the close is very near the HOD.
 
 /* A/D Line Tightening and Expansion Scanner for StockFetcher */
 /* === Parameters === */
 set{ma_length, 17}
 set{bb_length, 20}
 set{tightening_threshold, 0.85}
 set{obv_min_delta, 0}
 /* === Close Location Value (CLV) & Money Flow === */
 set{high_low_diff, high - low}
 set{close_low_diff, close - low}
 set{high_close_diff, high - close}
 set{clv_numerator, close_low_diff - high_close_diff}
 set{clv, clv_numerator / high_low_diff}
 set{money_flow, clv * volume}
 /* === Accumulation/Distribution Line (100-day sum) === */
 set{ad_line, sum(money_flow, 100)}
 /* === A/D Line Early Tightening Detection === */
 set{ad_stddev, standard deviation(ad_line, bb_length)}
 set{ad_stddev_7, ad_stddev 7 days ago}
 set{ad_stddev_avg, cma(ad_stddev, 14)}
 /* Look for declining volatility trend (early tightening signal) */
 set{volatility_declining, ad_stddev < ad_stddev_7}
 set{below_avg_volatility, ad_stddev < ad_stddev_avg}
 set{early_tightening, volatility_declining * below_avg_volatility}
 /* Also look for A/D line showing accumulation pattern */
 set{ad_line_5, ad_line 5 days ago}
 set{ad_trending_up, ad_line > ad_line_5}
 set{pre_breakout, early_tightening * ad_trending_up}
 /* === Price Above Trend === */
 set{ema34, ema(34)}
 set{ma20, ma(20)}
 set{above_ema34, close > ema34}
 set{above_ma20, close > ma20}
 set{price_strength, above_ema34 * above_ma20}
 /* === Trend Strength (ADX approximation) === */
 set{adx14, adx(14,14)}
 set{trend_strength, adx14 > 20}
 /* === OBV Delta === */
 set{obv_today, obv}
 set{obv_yesterday, obv 1 day ago}
 set{obv_delta, obv_today - obv_yesterday}
 set{obv_strong, obv_delta > obv_min_delta}
 /* === Final Filter Condition === */
 pre_breakout is above 0.5
 and price_strength is above 0.5
 and obv_strong is above 0.5
 and set{close_to_high, close / high}
 close_to_high > 0.85
 ADX(14,14) > 20
 
 
 /* Additional filters for practicality */
 and average volume(30) is above 500000
 and close is above 1
 and close is below 7
 and shares outstanding < 100
 add column shares outstanding
 and not etf
 do not draw obv_strong
 add column close_to_high
 sort column 6 descending
 do not draw OBV_Delta
 draw ad_line
 
 
 |