• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

[Release] Historical data download helper

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Release] Historical data download helper

    Hi everyone. I know this is my first post on the forum but I am making this post to help everyone, else with a problem that I had which was limiting my use of NinjaTrader.
    I was not able to find this online for free, so I want to share this simple script which I created and I hope you guys are welcoming of that because as far as I know, we are limited to downloading 1 day at a time. I seen there were solutions available online for a fee unfortunately I do not have the funds and I'm sure there are others like myself who would appreciate this.
    I present you all with this simple autohotkey script which you can build and compile yourself.
    What this does is automate the process of entering all the dates so you don't have to manually click for every day. This is essentially useful if you plan on trying to download over a year worth of data, and are limited to manually downloading every day.
    How it works is press F10 to get the location and color for the download button
    Press F11 to get the location to click to enter text
    Press F12 to activate which Checks for the color for the download box at the location to click the download button, in order to see if its possible to continue
    Then the text is automatically entered for you in descending dates based on the start day you provided.
    Further instructions can be found in the comments. Thank you all for reading and I hope you enjoy this release I hope I can at least help one person. Thank you all again, and good luck traders.
    Code:
     
    #Persistent
    #SingleInstance
    ;//Welcome. Thank you for using my script brought to you by Elijahxtm
    ;//Instructions here
    ;//Press F10 while hovering over download to get mouse location and color
    ;//Press F11 while hovering over text input box to get mouse location to enter text
    ;//Before use change x,y,z for current day and month and optionally the sleep ammount and number of days.
    ;//Press F12 to start the script
    ;//===================================================================================================
    
    MsgBox, "Press F10 while hovering over the download button. Press F11 to set Again. Press F11 to set text location, F12 to start. ;//Get first input for download button
    ;//Calulate x y z enter current date
    x = 11 ;//Current Month ------------Change this
    y = 21 ;//Current Day  -------------Change this START DATE
    z = 2019 ;//Set year   -------------Change This
    numDays = 365 ;//Number of days to download 
    intSleep = 500 ;//Set sleep ammount in between requests
    
    ;//Get download button position and color
    F10::
    {
    MouseGetPos, MouseX, MouseY
    PixelGetColor, color, %MouseX%,%MouseY%
    dlCoordX = %MouseX% ;//Save these for later
    dlCoordY = %MouseY%
    dlColor = %color%
    
    ;;;;;;MsgBox, %dlCoordX%,+ " "+ %dlCoordY% + " " + %dlColor% ;Optional msgbox
    return
    }
    
    ;//Get text box position to click
    F11::
    MouseGetPos, MouseX, MouseY
    inpCoordX = %MouseX%
    inpCoordY = %MouseY%
    ;;;;;;;;;MsgBox, %inpCoordX%,+ " " + %inpCoordY% ;Optional msgbox
    return
    
    Esc::
    ExitApp
    Exit
    return
    
    ;//Start script
    F12::
    ;//loop
    i = 0
    while (i<numDays) {
        i++  
        y -= 1
    if (y == 0) {
            y = 30
            x -= 1
            if (x == 0) {
                x = 12 ;//Error handling for if month is invalid
            }
        }
    ;//Press enter to clear error messages
    Send, {Enter 2}
    
    ;//Check for download button color at F10 location
    PixelGetColor,Px,Py,%dlCoordX%,%dlCoordY%,%dlCoordX%+2,%dlCoordY%+2,dlColor,5,fast
    if (ErrorLevel = 0) {
    MouseMove,%inpCoordX%,%inpCoordY%, 2
    Click,%inpCoordX%,%inpCoordY% ;//Click
    
    //Mandatory sleep before deleting text
    Sleep,1000 
    
    ;//backspace
    Send, {Backspace 10}
    Sleep, 500
    
    ;//Type date
    Send, %x%
    Sleep,200
    Send, %y%
    Sleep,200
    Send, %z%
    }
    ;//Check for download button color at F10 location
    PixelGetColor,Px,Py,%dlCoordX%,%dlCoordY%,%dlCoordX%+2,%dlCoordY%+2,dlColor,5,fast
    if (ErrorLevel = 0) {
    ;//Click download
        MouseMove, %dlCoordX%,%dlCoordY%,2
        Click, %dlCoordX%,%dlCoordY%
        Click, %dlCoordX%,%dlCoordY%
    } 
    ;//Sleep inbetween
    Sleep, %intSleep%
    }

Latest Posts

Collapse

Topics Statistics Last Post
Started by futurestrader7, Today, 11:31 AM
0 responses
3 views
0 likes
Last Post futurestrader7  
Started by Teebone21, Today, 10:38 AM
0 responses
6 views
0 likes
Last Post Teebone21  
Started by J_o_s, 03-30-2020, 12:29 AM
2 responses
15 views
0 likes
Last Post J_o_s
by J_o_s
 
Started by ptpatrader, Today, 10:27 AM
0 responses
4 views
0 likes
Last Post ptpatrader  
Started by albertokeira, Today, 09:30 AM
0 responses
8 views
0 likes
Last Post albertokeira  
Working...
X