Auto Trade (ALGO) in TOS

@aCuddlyTurtle Put '^9::' below '^0:: Pause'.
Code:
^0:: Pause

^9::
i am using SciTE for my autohotkey
Why? You have AutoHotKey installed.
Open Notepad past in your code and save with .ahk extension, then just right click on the file with your code in it and select run as administrator.
Looks like you've have set crtl+9 as key combination to start the script
.
 
Last edited:
@Svanoy Ok i'll try that and see what happens. Im also going to remove SciTE, I added it because when writing code with it, it color codes stuff and is easier to see what im doing.
 
@aCuddlyTurtle
I tested your code with my labels and it worked.

Look back at an earlier post of mine about making the image files AHK references, post #63. Specifically the part about making your reference images smaller than the on screen label.

Also double check your file directory where you have the image files saved, make sure it matches the directory defined in your ImageSearch.
Lastly, I find images saved as .tiff work generally work better
 
@Svanoy i'll check because Im not sure about the ahk references. I read that post about that image a few times. what i did was take a picture of the spot where all my labels are, then I opened up paind 3d and cropped out a buy label and a sell label, and i cropped the image to where it was solid green or red. i'll go back and read it again and see if im missed something.

edit: when i cropped the image i also made the image 24x24 and added that to my code
 
@aCuddlyTurtle You can't resize the cropped image. By doing that you are telling AHK to look for an image that is bigger than what is being displayed on screen. Use the pixel size of the cropped image, whatever it may be.
 
@Svanoy Im sorry thats what I did, I used the size of the new cropped image. I actually just went and made all new images and still no luck. maybe im naming the image wrong? I tried saving the .tiff file as "BuyLabel" and "BuyLabel.tiff"
 
@aCuddlyTurtle. Max height of a label is 19 pixels and that is including the border pixels that wont be an exact match, so you reference image has to be less than 19 pixels in height to remove the border pixels. Same goes for the width, reference image has to be narrower than actual label.
Open the image files you made in paint 3D and post a screen shot of them
 
example1.png
example2.png
 

Attachments

  • example1.png
    example1.png
    87.6 KB · Views: 251
Last edited by a moderator:
yep, I was wrong about max pixel size,
With the amount of room you have to work with, go ahead and crop down to a 20 by 20. That way you know the border pixels are not going to cause an issue.

Also I notice the file path you are using in your image search is exactly the same as mine. I find this odd.
 
@Svanoy Well the file path is the same as yours because I copied the path from your orginal script. I figured since I saved the images in a folder on my desktop that we would have the same path. But after looking my path is different, But it still does not work. i'll try the 20x20 I think I may be messing up somehow on the file path..
 
@aCuddlyTurtle
Using a 20 by 20 pixel image and your file path, you ImageSearch code should look like this:

Code:
ImageSearch, FoundX, FoundY, 25, 226, 239, 272, *w20 *h20 C:\Users\bqe27\OneDrive\Desktop\AutoHotKey Images\SellLabel.tiff
 
Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance [Forced]

CoordMode, Pixel, Screen
Delay = 10000

^0:: Pause

Loop{

;Watch for Buy Signal
ImageSearch, FoundX, FoundY, 27, 230, 161, 269, *w20 *h20 C:\Users\bqe27\OneDrive\Desktop\AutoHotKey Images\BuyLabel.tiff

;If found click mouse on random screen location, send ctrl + f key combo, send ctrl + b key combo.
    If (ErrorLevel = 0)
        {
        MouseClick, Left, 1747, 248, 1, 0
        delay = 10
        Send ^{f}
        delay = 10
        Send ^{b}
        }
;If not found do nothing
    Else If (ErrorLevel = 1)
        {
        }
;Watch for Sell Signal
ImageSearch, FoundX, FoundY, 27, 230, 161, 269, *w20 *h20 C:\Users\bqe27\OneDrive\Desktop\AutoHotKey Images\SellLabel.tiff

;If found click mouse on random screen location, send ctrl + f key combo, send ctrl + s key combo.
    If (ErrorLevel = 0)
        {
        MouseClick, Left, 1747, 248, 1, 0
        delay = 10
        Send ^{f}
        delay = 10
        Send ^{s}
        }
;If not found do nothing
    Else If (ErrorLevel = 1)
        {
        }

}Return
 
@aCuddlyTurtle
You removed the ctrl+9 key combo to start the script running. It does not start on it own.
Put it below the Pause and above the Loop statement.
After you run the script file, press ctrl + 9 to start it.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
239 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top