OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


  Current location        Thread information  
OmniTrader Professional Forum
OmniScan
Help with scan
Last Activity 4/5/2017 7:35 AM
10 replies, 1622 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back reply
Printer friendly version

^ Top
Jarrod

Member

Posts: 15

Joined: 7/27/2010

User Profile
 
Subject : Help with scan
Posted : 3/22/2014 1:12 PM
Post #22783

I need help with a scan looking for stocks that have made a 52 week high in the last 4 weeks , obv is higher than 6 months prior and the stock is currently retraced back to the mid to lower keltner channel with the keltner settings at 20,2.0,10
Jarrod
^ Top
Jim Dean

Sage
20001000100
Posts: 3108

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Help with scan
Posted : 3/22/2014 1:54 PM
Post #22784 - In reply to #22783

52 week high in the last 4 weeks:

... OLang solution
GotHi = false
for N = 0 to 19
if H[N] > HHV(260)[N+1] then GotHi = true
next N

BUT ... since "false"=0 and "true" = -1, we can express this as the sum of 20 tests (ie 4 weeks)
Sum((H > HHV(260)[1]),20) < 0

-----------------
OBV higher than 6 months prior:

OBV() > HHV(OBV(),130)[1]

-----------------
Your Keltner channel = EMA(20) +/- 2*ATR(10), so, Price between midline and lower:

EMA(20) - C >= 2*ATR(10)


-----------------
I set up these three rules in an OScan of All US Stocks (11k symbols), and there wasn't even ONE symbol that passes all the tests

So your rules might have to be loosened up a bit. For instance, if you want the stocks for which any TWO of the three rules are true, you can do this:

( EMA(20) - C >= 2*ATR(10) ) +
( OBV() > HHV(OBV(),130)[1] ) +
( Sum((H > HHV(260)[1]),20) < 0 ) <= -2

... which gives 162 hits




[Edited by Jim Dean on 4/8/2014 11:29 AM]

^ Top
Jarrod

Member

Posts: 15

Joined: 7/27/2010

User Profile
 
Subject : RE: Help with scan
Posted : 3/22/2014 2:47 PM
Post #22785 - In reply to #22783

Thanks Jim!
^ Top
Jarrod

Member

Posts: 15

Joined: 7/27/2010

User Profile
 
Subject : RE: Help with scan
Posted : 3/22/2014 3:01 PM
Post #22786 - In reply to #22783

Jim ,
The 52 week high within last 4 weeks is not bringing up any stocks for me at all. Any solutions?
Jarrod
^ Top
Jarrod

Member

Posts: 15

Joined: 7/27/2010

User Profile
 
Subject : RE: Help with scan
Posted : 3/22/2014 3:16 PM
Post #22787 - In reply to #22783

I believe I got it working now.
Jarrod
^ Top
Jim Dean

Sage
20001000100
Posts: 3108

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Help with scan
Posted : 3/22/2014 6:06 PM
Post #22788 - In reply to #22784

Glad to hear it.

Note: these scan rules are GOOD ONES to learn from. They utilize several tricks and techniques that the majority of OT users are unfamiliar with:

1. Function calls that specify a function as the dataseries instead of just price
2. Function calls that use a Boolean result as the data series
3. Use of the Sum function to check for a condition during a time window
4. Math operations (addition,here) on Boolean results in a formula
^ Top
Jim Dean

Sage
20001000100
Posts: 3108

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Help with scan
Posted : 4/8/2014 11:32 AM
Post #22839 - In reply to #22788

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)[1] ) +
( Sum((H > HHV(260)[1]),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)[1] ) +
( Sum((H > HHV(60)[1]),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]

^ Top
Vinay

Regular
2525
Posts: 53

Joined: 1/18/2012
Location: Planet Earth

User Profile
 
Subject : RE: Help with scan
Posted : 4/4/2017 12:41 PM
Post #28493 - In reply to #22783

This Boolean math trick (SUM) is brilliant. However for some reason it doesn't work with Setups. I used the following code in one Setup box to paint it green if the stock made 52 weeks high on any day during last 5 days otherwise yellow:

Sum( ( H > HHV(250)[1] ),5 ) < 0


However it displays green only if the stock in question has made 52 week high on previous day. If it made 52 weeks high on any other day during previous 5 days it doesn't show green but shows yellow. I think it's a bug.

^ Top
Jim Dean

Sage
20001000100
Posts: 3108

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Help with scan
Posted : 4/4/2017 1:45 PM
Post #28494 - In reply to #28493

See my reply on the TradeTight forum with two alternatives to try.

http://tradetight.org/forums/thread-view.asp?tid=1057&posts=10#M8915
^ Top
Vinay

Regular
2525
Posts: 53

Joined: 1/18/2012
Location: Planet Earth

User Profile
 
Subject : RE: Help with scan
Posted : 4/5/2017 5:38 AM
Post #28496 - In reply to #22783

Jim.. I tried both the alternatives which you kindly provided but unfortunately I am getting the same results as with my original formula.

^ Top
Jim Dean

Sage
20001000100
Posts: 3108

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Help with scan
Posted : 4/5/2017 7:35 AM
Post #28497 - In reply to #28496

Three other solutions are provided for you to try.

http://tradetight.org/forums/thread-view.asp?tid=1057&posts=10#M8917
Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.