Location: L'ville, GA
PLEASE NOTE: I made a mistake (gasp!) in the fancy OScan formula provided earlier in this thread. I had noted that it seemed to perform incorrectly under some circumstances ... but since then, I've discovered that it performs JUST FINE, IF my dumb mistake is corrected. The formula is:
( EMA(20) - C >= 2*ATR(10) ) +
( OBV() > HHV(OBV(),130) ) +
( Sum((H > HHV(260)),20) < 0 ) <= -2
The part I corrected is changing the last-line's ">0" to the correct "<0" shown above.
This is btw a set of conditions that don't occur very often, even when applied to All US stocks. If you want to "play" with this formula a bit, then you might loosen it up to give you more hits:
( EMA(20) - C >= ATR(10) ) +
( OBV() > HHV(OBV(),30) ) +
( Sum((H > HHV(60)),10) < 0 ) <= -2
The formula in that form says to show stocks for which ANY TWO OF THE THREE RULES are true. Change the final -2 to -3 to force all three rules to be true (like using "AND's" instead of plus signs), and change it to -1 to allow a pass if any one rule is true (like using "OR's" instead of plus signs)
As I said earlier, this is a VALUABLE example to study, for anyone who wants to be a "power user" for OmniScript. The "boolean math" is being used not only in the combination of the three distinct rules, but also it's being using in the "Sum()" statement ... adding up ten successive instances of boolean tests.
If you want some further information about this kind of cool boolean math, click here
[Edited by Jim Dean on 4/8/2014 12:04 PM]