So simple but still does not work?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wherdendorf
Posts: 11
Joined: 23 May 2022, 12:18

So simple but still does not work?

Post by wherdendorf » 23 May 2022, 15:19

Image

This is a stock trading script. To automate the buy and sell This is so simple but does not work. A little help please.

code..................

Code: Select all

Loop
{
    CoordMode, Pixel, Window
    PixelSearch, FoundX, FoundY, 1158, 222, 1487, 951, 0x8B378B, 10, Fast RGB
    If (ErrorLevel = 0)
    {
        Click, 1734, 578 Left, 1
        Sleep, 10
    }
}
[Mod edit: [code][/code] tags added.]

dipstick5000
Posts: 31
Joined: 21 Jan 2020, 22:01

Re: So simple but still does not work?

Post by dipstick5000 » 23 May 2022, 15:48

Pixel search errors can also equal 2. I don't know if this has anything to do with your problem, but maybe try if error is not equal to 0? It's been years since I used AHK and I'm having a problem of my own. Maybe you could help with a simple API request, but please don't feel obligated or anything. I hope I gave you at least an idea to fix your problem.

Rohwedder
Posts: 7672
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: So simple but still does not work?

Post by Rohwedder » 24 May 2022, 06:08

Hallo,
try.

Code: Select all

Loop
{
    CoordMode, Pixel, Window
    PixelSearch, FoundX, FoundY, 1158, 222, 1487, 951, 0x8B378B, 10, Fast RGB
    If (ErrorLevel = 0)
    {
        SoundBeep, 4000, 20 ;to test if the Click was sent
		SendLevel 100
		Click, 1734, 578 Left, 1
        Sleep, 10
    }
}
and run this second script:

Code: Select all

~*LButton:: ;to check if and where the click was sent to
MouseGetPos, x, y
ToolTip, %x% %y%
SoundBeep, 1000, 20
Return

wherdendorf
Posts: 11
Joined: 23 May 2022, 12:18

Re: So simple but still does not work?

Post by wherdendorf » 26 May 2022, 15:26

Thanks so much for your reply, much appreciated. Code works great But is not automatic in detection of pixel color in window. It does move mouse and click but only when the mouse is moved over to that pixel color. These charts change every minute with a new bar forming in the window. The purple color purple represents every sell order that is to be placed when a new bar appears. So as soon as that color appears in the window the mouse would only click the sell button 1 time.
No need to monitor the screen only to open program in the morning and close it later in the day. Hopefully make some money. I hope this explains it a little better than the last post. Again, thanks for your help.

Post Reply

Return to “Ask for Help (v1)”