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.

Is there a way to get the current price (last price) for a scan?

I'm building a scanning script that basically says,

a) is today's high higher than yesterday's high?
b) was yesterday's close below the Ichimoku tenkansen/conversion line but today's is above?
c) was the price higher around 5-9 days in the past (showing that there's been a pullback that is probably recovering)

I get some useful results, but also get a bunch of stocks that spiked way up (so "today's high" is higher than yesterday's close), but then the stock crashed down 5%. I want to find a way to get the current price, or the 30 minute high, or something that isn't just the open, close, high or low. Can anyone point me in the right direction?

Comments

  • markdmarkd mod
    edited December 4
    Pattern scans will always get some junk because 1 - patterns are variable in height and length and 2 - until you see the results you don't realize what you are really asking for is not necessarily what you think you are asking for, or even what you really want. Reviewing the results can help make edits that tighten it up or revise it altogether (or throw it away and start over - happens all time).

    That said, here is what you are asking for, as outlined above:

    // begin

    [group is sp600] // or whatever you want

    // this is a)

    and [high > 1 day ago high]

    // this is b) - I don't use Ichi, so I'm guessing there

    and [1 day ago close < 1 days ago Ichimoku Conversion Line(9,26,52)]
    and [close > Ichimoku Conversion Line(9,26,52)]

    // this is one possibility for c) - you said price - price is not a scan term so I assume you mean high.

    and [5 days ago max(4,high) > high]

    // end

    After you see the results, you can mess with parameters and offsets to see if it helps. Also run for some back dates to see how results vary over time. Pattern scans can get no results for a time and then dozens of results, depending on how the market is behaving. In general, you will probably tend to have more luck with symbols from the high result days, because those symbols are moving in tandem with the market and not as much against it.

    p.s.

    after reviewing this, line c) could also be, instead of what's there now:

    and [high < Upper Price Chan(10)]

    You could play with the 10 - maybe 8 or 12 or 15, etc.
  • What does your code look like? It's much easier to assist you, by working with your scan code.

    There is no real scanning on anything other than "Daily" data at the minimum. 30 minute is less than a day. But if you run the scan during the trading day, the current data is the incomplete daily data at the time.
  • Here is the code. I am using Ichimoku and following Blue Cloud Trading, who has a scanner that he made that looks for stocks that have dropped a big, then popped up above the tenkansen/conversion line, indicating they're ready to make another move higher maybe.

    The goal is to get this to show me results with stocks that are setting up potentially, without 50% of them being something that popped up at open (making "today's open higher than yesterday's close") but then crashed through the floor. It would be nice if we could reference a price other than open/close/high/low, like "last 30 minute candle's high" or something. If that's a thing.

    [ChartList is 5] and // (the 300 or so stocks I follow)

    [type = stock] AND [country is US] AND [[exchange is NYSE] OR [exchange is NASDAQ]] AND [market cap > 100] AND

    //both daily and weekly are above the cloud
    [[Daily Above Ichimoku Cloud is true] AND
    [Weekly Above Ichimoku Cloud is true]] and

    //weekly tenkansen/kijunset are in position
    [weekly ichimoku Conversion Line(9,26,52) > weekly ichimoku Base Line(9,26,52) ]

    and [daily high > daily Ichimoku Conversion Line(9,26,52)]

    and [today's close > yesterday's close]

    and [
    [today's high < 10 days ago high ] or
    [today's high < 9 days ago high ] or
    [today's high < 8 days ago high ] or
    [today's high < 7 days ago high ] or
    [today's high < 6 days ago high ] or
    [today's high < 5 days ago high ] or
    [today's high < 4 days ago high ] //or
    ]
  • In addition to markd's comments

    You are mixing Monthly, Weekly and the Daily requirements which also may be giving some issues. The data points during intraday periods are moving with each update of the data during the day. The Weekly paramater works best running on a week ending date. Similar to a Monthly requirement works best running the scan on a month ending date.

    Not saying that you can't mix the weekly and the daily and the monthly requirements, it is just you need to be aware that the Weekly is based on the partial week if not run on a week ending date. If you change the weekly to looking at, one weeks ago weekly Ichimoku... etc, you would be getting a better indication (and probably intention) for that filter. Same with the Monthly. It's early December now and the Monthly is based on this month's data. One Months ago Monthly.... would probably better result for that filter, in my opinion.

    You did very will with your nested OR statement at the end. This longhand version could be another source of variable results though. There are several ways to accomplish the same or similar results using Price Channels or Min/Max. @markd suggested using a bit of both of those, which is a sound and logic way to provide a way to play around with the variables to refine the filters to meet your needs.

    The way you have it, the High can be greater than the 10 days ago High as long as it's less than the 4 days ago high. Is that your intention?
  • markdmarkd mod
    edited December 5
    You have no test for today's open. If it matters, you could include one.

    As for a price that is not open/high/low/close, you can calculate an average or some weighted division of a sum or difference of prices, - e.g.

    and [open < [1 day ago low + [1 day ago range * .75 ]] // open is in lower 75% of yesterday's range

    or just

    and [open < 1 day ago high]

    or you can get as complicated as

    // open is above the average of yestserday's midpoint between high and low and midpoint between open and close

    and [open > [[[[1 day ago open + 1 day ago close]*.5]] + [[1 day ago high + 1 day ago high] * .5]] * .5]

    That's probably overkill, but just to show you can up with whatever you want. You could test for the high, low or close in similar fashion. Obviously, it's all experimental.

    As for crashing down, you could test for today's low above some acceptable level.

    and [low > [1 day ago low + [1 day ago range * .25 ]]

    For a sharp drop, instead of testing highs, you could test for two locations of Fast Stoch %K. Fast K tells you where the current price is in the range of some number of bars. The second parameter should be 1. So,

    and [10 days ago Fast Stoch %K(10,1) > 80] // ten days ago, price was in the top 20 per cent of the prior 10 day range

    and [Fast Stoch %K(10,1) < 20] // today's close is in the bottom 20% of the last 10 days range.
  • MarkD, thanks for your reply, that a lot cleaner than what I have. I am the king of making ridiculously complex scripts, whatever I'm working in. It's a shame there's no way to filter for "last 60 minute period's high" or whatever, but it's good enough for what I'm shooting for.

    Imkwin, yes I am mixing daily and monthly intentionally. The idea is just to only find things that have the moving averages where I want them on both the daily and weekly timeframe, to help filter out stuff I wouldn't want to invest in.


  • You can set up intraday (like hourly or 5 minutes) chart styles in classic charts - maybe ACP, too, I haven't tried it. Also in ACP you can display multiple charts in real time. Run the daily time frame scan for candidates over night, then take say, the top four, and put them into the ACP grid with an intraday time frame. Just noodling.
  • lmkwinlmkwin ✭✭
    edited December 9
    In SharpCharts you can customize Gallery View charts. Gallery View displays one intraday period, one daily period and one weekly period chart and one PnF chart, for a symbol, on one page. You can customize your Gallery View charts using a naming technique for the different chartstyles.

    https://help.stockcharts.com/charts-and-tools/other-charting-tools/galleryview

    You can even view two symbols, side by side, in Gallery View.

    I have certain preferred chartstyles that I created to use as defaults. I may want to look at a Daily chart, an intraday chart, a weekly chart, or a PnF chart. For ease of use, I name my preferred weekly chart, GalleryWeekly. My preferred daily chart I named GalleryDaily. Intraday chart? GalleryIntraday. And my favorite chart, the PnF chart, has "my" default chartstyle.

    About half way down the page on the above link is where they discuss "Customizing Gallery View". There are certain restrictions that apply, but it's a way to use a multi period view of a symbol(s) in SharpCharts.

    For those that don't appreciate ACP's multi panel options, GalleryView is a good option.

Sign In or Register to comment.