Adjusting the Interval In TradingView

I have this list of clickable options in an app:

(The app is TradingView)

These are the options for different intervals.

I want to be able to toggle these with two keyboard keys: one to go up the list, one to go down the list.

I cannot figure out what the most efficient way to do this would be. I guess I could use a very complex "If Then Else" structure in combination with either "Click at Found Image" (breaks when the look is changed) or a simple "Move or Click Mouse" (breaks when interface is re-arranged or I move the window). But that seems very convoluted and slow.

Surely there is a better way, right?

I'm not with my Mac, but for the click next item macro you could try:

Move mouse to stored position (if global variable is not empty)
If current mouse x-axis position < [position of rightmost item]
Then move right by [required pixels to click next item to the right] and click
Else click [position of leftmost item]
Store current mouse position

All positions can be calculated relative to a front window corner or relative to a static found image reference.

Then the same but in reverse for the click previous item macro. Might take some experimentation of course.

Having said all this, there may be an AppleScript method. @ccstone?

Also, I'm assuming you checked the app doesn't have dedicated shortcuts for this?

I don't know whether to laugh or cry over this one...  :sunglasses:

Software is complicated, and quite a lot of Mac software doesn't implement accessibility worth a flip.

It might be possible to access those elements via AppleScript UI-Scripting, but I wouldn't bet on it. You have to test to see, and that gets complicated for the uninitiated.

Thanks! I'm going to have to wrap my head around that and try it out :slight_smile:

[quote="noisneil, post:2, topic:30472"]
Also, I'm assuming you checked the app doesn't have dedicated shortcuts for this?[/quote]
It does not, unfortunately.

I was actually hoping for an easier solution within KM that I am overlooking. Something like a list of options how the found image could look (which interval is blue) with attached actions for example.
But I will play around until I find a solution.

'Fraid not..


The action has more features than most people realize though:

KM Wiki – Find Image on Screen action

1 Like

Ok so another thing you could do is:

Click x pixels to he left of rightmost selected button image (to click leftmost button). Set not to abort on failure.

If %FoundImage% is not empty then Cancel This Macro


Have a bunch of Find Image on Screen actions, one after another, each one looking for each of the remaining selected button options and set not to abort macro on failure. Then set a variable to %FoundImage%. Finally, click x pixels to the right of this location.

For example

Local_SelectedLocation.MidX + 30

Thank you! I have actually just found the Switch action which does just what I was looking for. Using a variable I have found a way to toggle the timeframes perfectly. I've created one macro for toggling up and one for toggling through them down.


Great! Please post your solution. :sunglasses:


I should note, that I find out that it is possible to change "Intervals" (timeframes) in that application by simply typing the number and hitting return. For that reason I was able to do this without mouse clicks.


It just keeps going through all the intervals that interest me like this. The last line is this:


to make sure that there is no error if the variable is empty (as I assume it will be after a restart maybe?).

The Macro for toggling through the intervals in the other direction is the same, just reversed.