#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

# CMF / MACD Hist Divergence

I'm interested in Weekly Charts locating Divergences near a probable bottom (retracement) using CMF and MACD Hist. EXTREMES. I can set up a basic scan that will do this...
[weekly MACD Hist(12,26,9) <=-.06] and
[weekly CMF(26) >= .06]

However, each individual stocks MACD Hist and CMF weekly levels vary greatly depending (MACD Hist-2.25 to say CMF + .275) on the stock and it's inherent nature. So setting "specific" level number(s) to test against leaves a lot of potential stocks out of the picture. Is there a way to account for each stocks inherent nature (CMF Spread 0 to High) or (MACD Hist Spread 0 to low) in the programming? How would I set that up?

• mod
For MACD, use PPO instead. PPO is a version of MACD that expresses the difference between the two EMAs as a percent, so its readings are comparable across symbols.

Here's a link to the Chart School article:

https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:price_oscillators_ppo

Chaiken Money Flow is a bounded oscillator (+1 to -1) so its values are already comparable across symbols.

However, for both indicators, it doesn't seem the particular values have intrinsic meaning - extreme reading might or might not indicate a turn, and good turns can happen without extreme readings.

But, if you think these two indicators are correlated in some way, you could test for a divergence in extreme readings over some period of time - for instance, PPO Hist is the lowest value in the last x bars, but CMF is not, or vice versa.

For instance, these two lines look for PPO hist making a new 21 day low, while CMF stays above its 21 day low:

// begin PPO-CMF divergence scan

[group is sp500]

// PPO Hist hits 21 day low
and [PPO Hist(12,26,9) = min(21, PPO Hist(12,26,9))]

// CMF stays above its 21 day low
and [CMF(21) > min(21, CMF(21))]

// end scan

I have absolutely no idea if this finds good set ups. It is just a coding example for finding divergences. You might want to add further conditions - PPO Hist and/or CMF is greater or less than zero, or some other number. You might also want to play with the default parameters of the indicators and the length of the look back period (here it's 21 - you would want it to be the same look back for both indicators).