Please see attachment below for the question.
Can you export the chart data to CSV?
Working only from the graph will be difficult, if not impossible, for KM. But this is a good use-case for AI -- uploading your screen shot to Copilot (using GPT 5.5 Think) then asking "At what points do the orange and blue lines intersect?" got me:
From the screenshot, the clearest orange/blue intersection appears to be around the arrow-head area, at approximately:
- Price: about 1.69 to 1.70
- Time: roughly around 10:00 on the 5-minute chart, between the 09:00 and 12:00 axis labels
Visually, that is where the blue EMA 9 line comes up into the orange VWAP line during the start of the sharp upward move.
There may be a couple of very close touches earlier in the session, but from the screenshot alone the only meaningful/clear crossover is the one near 1.69.
It also guessed this is TradingView and that you could set an "alert condition" in the software -- maybe look into that?
There is an action in macOS Shortcuts which lets you submit a question, including images, to Apple’s Private Could Compute, which is free. In that action, you can type your question about the chart. You can call that action from KM. I use a macro that does this every day, roughly 100 times per day.
The problem with the question is that the coloured horizontal lines intercept approximately 20 times with the vertical bars, at least in this example. So I’m not sure what Bernard actually wants to conclude in this case. If he is interested only in the last hour, then I guess he could capture only that portion of the graph.
I wrote a tiny KM script which submitted this image to PCC which returned (part of) the right answer! Here’s what it replied: (I had to exclude the bottom few pixels to the graph because the timestamp on the bottom confused PCC as part of the X-axis label, which is quite reasonable.)
Upon examining the provided image, we can observe the following:\
The Horizontal Blue Line: This line is positioned at a specific price level on the chart.\
The Vertical Lines: There are two vertical lines in the image, one at 09:00 and the other at 12:00.\
Intercepts of the Horizontal Blue Line\
At 09:00: The horizontal blue line intersects the first vertical line at a price level of approximately 1.69.\
At 12:00: The horizontal blue line intersects the second vertical line at a price level of approximately 1.80.\
Summary\
In summary, the horizontal blue line in the image intersects both vertical lines. It crosses the first vertical line at around 1.69 and the second vertical line at approximately 1.80.
The blue line actually crosses the green lines approximately 20 times in the image, but it did accurately return the last two occurrences. It returned both the X-axis of every location plus the Y-axis.
Here’s the Shortcut:
I have never hit a usage limit in PCC, Even when submitting 100 images over 10 minutes, but if you ran this script all day long, every minute, like Bernard seems to want, then you might hit a usage limit.
This is the hard part of the answer. The easy part is notifying the user of the fact that the bars cross. But I won’t provide that because I’m uncertain whether the user really wants to do this.
P.S. My first impression of this thread was that it was a stock-pushing spam thread. But I was wrong; sorry.
Wrong intersection -- we want the point(s) on the graph where the orange and blue lines intersect. That happens a few times, but can you see if Apple's AI can a) spot the occurrences, and b) return only the right-most (most recent) one?
Oops. I’m only human. I messed up the requirement. It will take me a couple of minutes to re-do this.
Yes, I changed the Shortcut to: (spelling error included!)
Does the horizontal blue line in the following image interept the horizontal orange line at any point, and if so, where?
And it returned a better (but not perfect) answer:
Yes, the horizontal blue line in the image intersects the horizontal orange line at the point where the price is approximately 1.78.
No programming changes required (!!!), just a small modification to the wording of the question, which shows how powerful this technique is.
In fact, a wrong answer...
Can you try again, missing out both "horizontal"s? I refuse to admit that Copilot <spit> can beat Apple AI <hurrah!>, though I might be showing my training bias ![]()
Why do you say “wrong”? (You didn’t explain.) I said that the answer was better but not perfect. It was off by 5%, which arguably means the answer was 95% right, not 100% wrong. If I had more charts to test, I could determine how accurate it really is, but Bernard only uploaded one test shot, which was in fact damaged with annotations. With only one test case, and with that case annotated with unwanted text, it’s really hard to test my solution.
Okay, I removed the words “horizontal” and added the phrase, “ignore all vertical lines in the chart, and tell me how many times the lines cross” and got a slightly better answer:
In summary, ignoring all the vertical lines, the blue line intercepts the orange line at two distinct points on the steepest sections of their respective slopes.
It spotted only two of the four crossings. But in my opinion that’s not important, because I think the OP wants to be notified if the lines cross, and doesn’t really care how many times they cross. After being notified, the OP will check the chart and make actionable decisions. But we don’t really know because the OP didn’t explain himself in detail.
But I confess that Copilot’s answer reflects a more mature interpretation of the graph. It almost makes me want to switch to that product, but I like using built-in Apple features whenever possible, especially when they are free. You make a good case for ChatGPT. It’s very good.
Look at the graph -- the right-most intersection of the blue and orange line is ~10am on the x axis, ~1.69 on the y. So you only got half an answer, and that was wrong.
That's really not how it works. Or would you consider 90 + 10 = 95 to be 95% right?
Yes, there's margins of error when interpreting a graph. But it should be obvious that the arrowed intersection is on a level with the block containing 1.69 and some way below the one labelled 1.78 -- which makes me think it is picking up the wrong intersection. Maybe where the blue line crosses the red error bar at ~11:30?
I'm not so sure, since the OP includes
...will send me an alert where it intercepts
(Emphasis mine.)
...which I take to be "throws a dialog with data about the interception point", since you can't be alerted when it intercepts if you're looking at historic data. But yes, we're both guessing at OP requirements.
I still reckon Apple AI can do this, perhaps we just need to massage the prompt a little. If I can get on a machine that can use PCC I'll give it a try.
I agree, massaging the prompt is an important skill.
I agree, an accurate answer is the best answer.
I agree, we need more clarification from the OP.
Thanks for your response.
The chart is a stock trading chart specifically filtered to short term daily trading. The chart is TradingView which has the built in alerts function that I've described on my attachment and many more, in saying that TradingView restricts their alerts to regular trading hours 9.30 - 4.00 pm whereas daily traders also trade premarket 4.00 - 9.30 am and postmarket 4.00 pm - 8.00 pm. Like myself many traders just don’t understand why TradingView has that restriction.
I placed the post to see whether anybody has had exposure to that type of action.
I’m not a programmer and have a basic knowledge of KM. I’ll check out the CSV option and in the near future post another chart example with varying views and more data that be could be actionable.
Nige gives better answers than me. But he hasn’t answered yet, so I will throw in my two cents.
First, I want to know if you are able to access any AI model to submit queries about images. Are you subscribed to any AI service? This is important because both myself and Nige are trying to use AI services to solve your problem. I was trying to use a free Apple AI service called PCC, which is struggling to get the same quality of answers as the paid service he is using. Nige had better results than I did. So it would help if you are subscribed to the same service as he is.
Second, I want to know what you plan to do with this information. You said you wanted to be notified. Howso? Maybe a text message? In the meantime, will your Mac be displaying a single page which you want to monitor a single graphic, or do you need multiple pages monitored? Will a KM macro be able to run with the screen open and unlocked during the times you are away from the Mac? These details matter a lot.
Third, how frequently do you need this macro to run? Every 15 minutes? Every minute? Every second? These details matter a lot, especially because some AI services have usage limits.
Fourth, what does a TradingView alert look like? It would help us to see what kind of message you want, and through which medium.
To be honest, this is a pretty tough one to solve, at least for me. But I don’t give up easily.
Thanks for your reply, you’ve given me a lot to think about, I’ll answer your questions and send another sample chart, extrapolate on what I’m wanting to achieve so you are clear about the objective. I don’t want you or anybody else wasting your time I’m time rich so it doesn’t matter for me. It may take me a day or so, I’ll use the upcoming weekend and hopefully post on Monday.
What are the update intervals for the data in the hours you want this? The graph makes it look like update frequency varies by time of day and is every 15m after 9:30.
It sounds like you do want to be alerted when there's an intersection (not processing "old" graphs to find out when the intersection was). If the data updates at 9:30, 9:45, 10:00... would you be happy with checks (and possible alerts) at 9:35, 9:50, 10:05...?
Do the values of the intersection point matter, or is the fact that there was an intersection enough?
Does it matter what form the intersection takes, or should any intersection of the blue and orange lines trigger an alert? That is, should the "both climbing" intersection you show be treated differently to "both falling", or "orange climbing, blue falling", or "orange falling, blue climbing"?
Do have a look to see if you can get the raw numbers. If you can't get the CSV and you only want to see if the most recent update has resulted in an intersection you should be able to use the labels on the y axis -- 1.85 for orange, 1.80 for blue in your screen shot -- if the graph separates them even when the lines are close to each other.
I’ll post again on Monday answer all questions and provide more clarity so you’ll have a better understanding.
Good morning from Australia,
What are the update intervals for the data in the hours you want this? The graph makes it look like update frequency varies by time of day and is every 15m after 9:30.
As long as I'm running the program, there is no frequency or time.
It sounds like you do want to be alerted when there's an intersection (not processing "old" graphs to find out when the intersection was). If the data updates at 9:30, 9:45, 10:00... would you be happy with checks (and possible alerts) at 9:35, 9:50, 10:05...?
I will set the alert for every 15 seconds.
Do the values of the intersection point matter, or is the fact that there was an intersection enough?
The fact that there was an intersection enough
Does it matter what form the intersection takes, or should any intersection of the blue and orange lines trigger an alert? That is, should the "both climbing" intersection you show be treated differently to "both falling", or "orange climbing, blue falling", or "orange falling, blue climbing"?
The most important intercept is the first red crossing the blue climbing as it brings it to my attention any subsequent crossings are of secondary importance and I can switch the macro on and off to suit, maybe at a later stage the red crossing the blue falling could be actioned. Incidentally crossing is the correct trade terminology rather than intercepting.
Do have a look to see if you can get the raw numbers. If you can't get the CSV and you only want to see if the most recent update has resulted in an intersection you should be able to use the labels on the y axis -- 1.85 for orange, 1.80 for blue in your screen shot -- if the graph separates them even when the lines are close to each other.
This has been my thinking also the y axis corresponds exactly to the indicator lines.
Exporting a charts data to CSV is for historical purposes no use for real time daily trading which moves extremely quickly.
I'm already using 3 macros I had built for me, there is a Pushover action alert embedded already built into KM. There may be other actions that could be adapted as well?
The chart I attached is old I've since changed the indicator colours I have a chart screenshot from Fridays session exactly the same format with different indicator colours but it may lead to confusion if I attach it, let me know?
If you are checking every 15 seconds then an intersection two hours ago, or even a minute ago, is irrelevant.
You'll be hard-pressed to get AI analysis of the graph done within 15 seconds, especially in the cloud. You might do it if analysis was optimised with a Skill (or equivalent), particularly if you limited the image presented to the most recent portion of the graph, but even then I'd be concerned about the error bars (or whatever they are) being in the way.
But if you only want to know if the lines have crossed since you checked 15s ago, use the numbers on the side or, possibly, the top-left corner. For your "orange line crossing a rising blue line" there are actually four matches:
...but the logic is similar for each:
if nowBlue > oldBlue
if oldOrange < oldBlue AND newOrange > newBlue
-- first case
else if oldOrange > oldBlue AND newOrange < newBlue AND newOrange > oldOrange
-- second case
else if oldOrange > oldBlue AND newOrange < newBlue AND newOrange < oldOrange
-- third case
else if oldOrange > oldBlue AND newOrange < newBlue AND newOrange = oldOrange
-- fourth case
else
-- no intersection
end if
(You can combine some of those checks in exchange for reduced readability, but we'll leave things obvious for now.)
I'm going to assume that the legend in the top-left is consistent and we can always get the numbers we want from the end of the "VWAP" line (orange) and the first "EMA" line (blue). In this demo the first two Actions let you set the "old" values (that is, the values from 15s ago) so you can simulate different lines -- in actual use you'd store those "old" values in Globals, setting them to the "now" values at the end of each execution of the macro.
I'm using Preview to display the test image, you'd set it so the graph window was brought to the front and change the area OCRed to suit.
Line Intersections.kmmacros (17.1 KB)
That gives me another idea. None of this requires an AI model. It would be easy for a KM macro to use the PIXEL() function to look for a single blue and orange pixel on a specific column at the rightmost edge of the graph. Over time, the macro would “notice” that the vertical positions of the colours have changed, and a notification could be sent.
I’m aware that the PIXEL() function is very slow, and it might be so slow that it barely makes his 15 second requirement. But it could still work. On my Mac a single PIXEL function takes 0.2 seconds to execute, which is terribly slow, so it could be tough to achieve his 15 seconds timing, but if it’s 30 seconds between tests maybe he would accept that.



