How to read graph 'values' accurately and reliably

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
James9491
Posts: 34
Joined: 18 Feb 2016, 12:10

How to read graph 'values' accurately and reliably

Post by James9491 » 10 Aug 2022, 02:37

I'm writing code that should read a graph (yellow color pixels) and give a sound signal when the graph goes up and another sound signal when the graph goes down (it should also send commands to Buy or Sell, but for that, accuracy is mandatory).

The problem is that the graph in many cases gives several values (Y) on the same X axis (vertical line) and then it is difficult to know if the price has advanced or not. i.e visually you can see the number, but it is an image and not a value that can be read into to a variable.

I am currently doing a double check: reading from above and below. it gives the maximum and minimum value of the vertical line. So I make a sound, and enter into a lot of compares in order to know if I already got that price and made the notification for it or not.

Another problem is the fluctuation between the two values accepted from top_view and Bottom_view.
I tried using all kinds of variables to compare the values, but it's not accurate enough and there are still situations where the script goes into a loop and I don't get an unambiguous reading of the graph.

Is there any unique function that can help in this situation?
Or has someone already solved this problem?

I would appreciate any tips on the subject

James
Attachments
גרף בודד מסחר במעוף.png
גרף בודד מסחר במעוף.png (18.72 KiB) Viewed 369 times

User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: How to read graph 'values' accurately and reliably

Post by boiler » 10 Aug 2022, 05:26

You can tell if the value changed by capturing a screenshot where it reports the numbers and use that image as a reference for an ImageSearch loop that would detect when the image has changed. Then you would know the numbers have changed and then you can perform the part that determines how much.

You might also try OCR to read the numbers directly, although that can have its own reliability issues depending on the particular situation. It it happens to work well in your case, it would eliminate all the ambiguity.

Also, even though the numbers are an image, there may be other ways to read them such as this UI Automation library.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to read graph 'values' accurately and reliably

Post by swagfag » 10 Aug 2022, 08:40

first id ask the developers of ur application whether it already has built-in functionality for streaming this data to a pipe/message/file/whatever

otherwise, if u want an "accurate and reliable" way of retrieving the data, there's always ReadProcessMemory in a loop. but that requires specialized knowledge

Post Reply

Return to “Ask for Help (v1)”