- 2.4K All Categories
- 2K StockCharts
- 350 SharpCharts
- 107 Other Charting Tools
- 43 Saved Charts and ChartLists
- 1.3K Scanning
- 60 Data Issues
- 146 Other StockCharts Questions
- 172 Technical Analysis
- 126 Using Technical Analysis
- 1 InterMarket and International
- 17 Market and Breadth Indicators
- 28 Market Analysis
- 88 Trading
- 88 Trading Strategies
- 154 S.C.A.N the StockCharts Answer Network forum
- 59 Using this StockCharts Answer Network forum
- 95 s.c.a.n. archives
- 13 Off-Topic
- 9 The Cogitation & Rumination Emporium
- 4 Forum Test Area

New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Price spread is defined as absolute value of the high and low's difference.

and [absval(high-low) < absval(yesterday's high - yesterday's low)]

The above scan returned nothing, so something must be wrong. Could anyone help? Thanks!

## Comments

In any case, for your scan, you don't need an absolute value because the high will always be greater than the low (in some cases they could be equal, but the high can never be less than the low).

The difference between the high and low can be expressed using either "range" or "ATR(1)". Range looks at just the high and low made during the session. ATR (average true range) looks at the the high, the low AND the prior close. If that close is higher than the session high, it substitutes the prior close as the high. Vice versa for the low - if the prior close is lower than the session low, it substitutes the prior close for the low. The "1" parameter means the divisor for the average is 1, and it looks at only one data pair to average, so it is effectively the difference of one day's high and low.

So, here are two possible scans:

//and [range < 1 day ago range]

//and [ATR(1) < 1 day ago ATR(1)]

You could copy either one, or both, to your scan and remove the "//" from in front of the one you want to use.

I mistyped in my original post, I meant spread is defined as the difference between open and close. Since I don't know the relationship between open and close, that's why I tried to use absval.

and [absval(open - close) < 1 day ago absval(open - close)] didn't return anything, I suspect it's as you said absval doesn't work this way.

Help is still needed. Thanks!

"The issue is with the absolute value function. Currently, it is unable to accept date offsets, like “I day ago,” even when it appears in the rank by command."

If absval( ) could handle it, I think your scan would be:

and [absval(open - close) < absval(1 day ago open - 1 day ago close)]

but that gets no results either.

So the states for "close - open" (or "open - close", whichever you find easier to work with) would be:

day 1 positive [close - open > 0] (an up close, most of the time)

day 2 positive

day 1 negative [close - open < 0] (a down close, most of the time)

day 2 positive

day 1 positive

day 2 negative

day 1 negative

day 2 negative

To compare them, make both positive. So, for instance, for the second state pair, for day 1 negative you would multiply day 1 negative by -1, then compare it to day 2 positive.

The phrase below makes day 1 negative result positive:

[[close - open]* [-1]]

So the second "or" condition would be

// yesterday's close below the open

and [[1 day ago close - 1 day ago open] < 0]

// today's close above the open

and [[close - open] > 0]

// make yesterday's difference positive, compare to today's difference

and [[[1 day ago close - 1 day ago open]*[-1]] > [close - open] ]

The three statements are one condition. The first two lines account for the second combination of states for day 1 and day 2 listed above. The third statement compares day to day 2 after making day 1 positive.

So your complete "or" statement skeleton would be

and

[

[ condition 1 (compares day 1 positive and day 2 positive) ]

or

[ condition 2 (compares day 1 negative and day 2 positive - the 3 lines above) ]

or

[ condition 3 (day 1 positive, day 2 negative) ]

or

[ condition 4 (day 1 negative, day 2 negative) ]

]

I didn't run any of this through "check syntax" so you will have to be careful about keeping track of brackets.

[ [1 day ago close - 1 day ago open]* [-1] < 0]