#### Howdy, Stranger!

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

Options

# Bad Scan Results using an one of the examples

this is the scan I used,

[type = stock]
and [close > high * 0.98]

and it can be found here https://support.stockcharts.com/doku.php?id=scans:library:sample_scans

and it produced results that are clearly not correct, for example the Tickers AB and ABEV were one of many that was included in the results.
thanks

• Options
mod
Hi @Abosalam1985 ,

The results for the symbols you mention appear to be correct, assuming you ran the scan after the close for 7/12.

For AB the high on 7/12 was 30.95.

30.95 * 0.98 = 30.33

AB's close was 30.49 which is greater than 30.33.

For ABEV, the high on 7/12 was 4.93.

4.93 * 0.98 = 4.83

ABEV's close was 4.84, which is greater than 4.83.

I'm just guessing, but I wonder if you were thinking that "high" meant something other than the current bar's high, like the week's high, or 52 week high, or all-time high?

When there is no modifier in front of "high", like "weekly high" or "monthly high", then the default is "daily" (in other words, if you don't specify otherwise, the scan engine assumes you want the most recent daily value).

• Options
thank you mark for your reply, I should have done the math math to confirm before asking here on the forum sorry for the troubles

I am trying to include a clause that will produce results that contain a bullish bar where it closed near the high and in aforementioned tickers it clearly closed near the low.

I will keep experimenting but if anyone can help I will be thankful
• Options
mod
@Abosalam1985 ,

Well, I think the code for "Close Near Daily High" on the link you posted is not the best possible solution for the problem, and maybe I missed that that was what you were getting at:

I think it should be something like:

and [ close > low + [range * .98]]

The .98 parameter is pretty restrictive. You might want .75 or so.

You can also determine the nature of the bar, if you want:

UP -

and [high > yesterday's high]
and [low > yesterday's low]

GAP UP (no range overlap at all]

and [low > yesterday's high]

DOWN

and [high < yesterday's high]
and [low < yesterday's low]

GAP DOWN (no range overlap)

and [high < yesterday's low]

INSIDE

and [high < yesterday's high]
ans [low > yesterday's low]

OUTSIDE

and [high > yesterday's high]
and [low < yesterday's low]

If you want to determine whether the open and close are far apart (i.e. the candle body is most of the candle length), you could try

and [Long Body is True]

I'm just assuming that works with inside and outside bars, and bars of small range - I'm not sure.

Also, you can determine whether the range was unusual by comparing it to ATR (average true range) for a specified period.

For instance, was the bar wider that the average true range in the last month (21 trading days) by some amount:

and [range > atr(21) * 1.5]

Or was the range less than ATR(21)

and [range < atr(21) * 0.5]
• Options
thank you so much mark, you didn't only answer my question you helped with other question i was trying to find an answer (the inside outside candles )

you have been a great help Sir, thank you