Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

For Users Info: Auto importing price CSV files via NT Historical Price Dlg

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

    For Users Info: Auto importing price CSV files via NT Historical Price Dlg

    Some people are using NT in a similar to way to myself : importing crypto prices via CSV files for charting but no price feed into NT.

    For the longest time I've been doing this process manually, and somewhat tediously.

    I know that NinjaScript/C# does not support automating Hist Price importing. NinjaTrader assumes most/all their clients/users are using NT for traditional markets & NT is def geared towards having a Price Data Feed provider.

    Finally got around to tackling this project. Had to be done via the Win macros perspective, since cannot be done via NinjaScript (AFAIK).

    Most Win Macros/automation apps are useless... couple that I tried which "records" activity, then lets you replay.... Terrible & inaccurate performance.

    The ONE app which enabled me to complete this project was : AutoHotKey (www . autohotkey . com). It does NOT record activity, you are required to program it, then it plays your programming.

    This may sound like a LOT OF WORK. But I found it LESS WORK than trying to figure out the other useless "recording" apps.

    The AutoHotKey site includes excellent documentation on how its scripting language works. It took me part of 1 day to learn the steps I needed & implement.

    I would be happy to share my AutoHotKey code for importing Hist Prices if someone wants to shortcut this process.
    Just DM me for more info.

    #2
    Hello rhubear,
    Thank you for the message.

    In regard to Cryptocurrency Market data, there is a free real-time market data connection for Cryptocurrencies that is included with the NinjaTrader platform by default.
    • Go to the Control Center > Connections > Configure
    • Double-click the 'Coinbase' connection type in the 'Available' list to add it to the 'Configured' list
    • Click OK
    • Go to the Connections menu and connect to the "My Coinbase" connection that was just made
    You will now be able to Chart and Simulation Trade Cryptocurrencies within the NinjaTrader platform.
    Clayton G.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by rhubear View Post

      I would be happy to share my AutoHotKey code for importing Hist Prices if someone wants to shortcut this process.
      Just DM me for more info.
      After couple of people asked me for my AutoHotKey code, I thought I'd post it directly here. Its not that long....

      First some notes re this macro....
      1. When running the macro, I FIRST (manually) click on the NinjaTrader Control Window. I initially wanted a macro that would switch to/activate the NT Control Window as well (code still in 1st line), but that didn't seem to work, so I do that manually BEFORE hitting the HotKey for the macro. The <Cntl>J HotKey was almost randomly chosen, just change it to whatever you want.
      2. On my Win10 desktop, I usually Sleep/Resume Window rather than shutting it completely down. I did find that after a resume, the macro behaved very strangely. I had to re-run it to get it to behave. To AVOID macro problems AFTER a resume, I merely R-Click on the AutoHotKey system tray, click "Reload this script". Reloading tends to resolve issues with macro.
      3. The prices I import are 60min prices (Hourly). This macro is therefore designed for importing TWICE. First time a 60min "raw" import, second time uses the Ninja "convert to daily prices" option.
      4. This Macro is designed to import CSVs from a particular folder on my HD. In case I've been accessing other folders recently, the script navigates to "parent" folder, then re-navigates to my "usual" folder. You will need to rework the initial folder navigation which happens BEFORE any importing is done.

      ------------------------------------------------------------------------------------------------------------------

      ^j::
      WinActivate, Control Center Log
      Send !+h
      WinActivate, Historical Data

      ;## importing hourly prices
      ;## Changes Folder to USDT via parent folder using keyboard in case def folder has changed
      Send {TAB 16}
      Send {Space}
      Send {Tab}
      Send {Space}
      Send {TAB 6}
      Send {Enter}
      Sleep 1000
      Send {TAB 5}
      Send {RIGHT 3}{Enter}
      ;## Following commands need break/sleep in between otherwise they don't work!
      Sleep 500
      Send {Tab}
      Sleep 500
      Send {Tab}
      Sleep 500
      Send {Tab}
      Sleep 500
      Send {Tab}
      Send {UP 10}{DOWN 7}{Enter}

      ;## should be at USDT folder; now select files
      Send {Space}
      Send ^a
      Send {Enter}
      Sleep 4000
      Send {Enter}

      ;## Importing Daily Prices
      Send +{Tab}{Space}{Tab}{Enter}
      Send +{Tab 2}{Space}
      Send ^a
      Send {Enter}
      ;## Pausing script for "completed" dlg to appear.
      Sleep 5000
      Send {Enter}
      Send {Alt down}{F4}
      Send {Alt up}

      ;## MsgBox, Daily & Hourly Prices Imported

      return

      Comment


        #4
        OK, updated AutoHotKey script; allows you to specify a path directly into script, rather than trying to choose correct path playing with key strokes.
        I myself was having a problem getting the correct directory to be chosen, sometimes worked, sometimes not. Ended up using this method to be able to type the whole path directly into Explorer. Works fine for me...

        ^j::
        WinActivate, Control Center Log
        Send !+h
        WinActivate, Historical Data

        ;## Navigating to Historical Data File Browser
        Send {TAB 16}
        Send {Space}
        Send {Tab}
        Send {Space}
        Send {TAB 6}
        Send {Enter}

        ;## IMPORT HOURLY PRICES

        ;## Changes Folder to USDT via Explorer in File Browser
        Send {TAB 5}
        Send {Space}
        Send {Backspace}
        SendRaw C:\Users\rahee\PyEnvs\CryptoPrices\USDT
        Send {Enter}
        Sleep 500
        Send {Tab}
        Sleep 500
        Send {Tab}
        Sleep 500
        Send {Tab}
        Sleep 500
        Send {Tab}

        ;## should be at USDT folder; now select files
        Send ^a
        Send {Enter}
        ;## Pausing script for "completed" dlg to appear.
        Sleep 4000
        Send {Enter}

        ;## IMPORTING DAILY PRICES
        Send +{Tab}{Space}{Tab}{Enter}
        Send +{Tab 2}{Space}
        Send ^a
        Send {Enter}
        ;## Pausing script for "completed" dlg to appear.
        Sleep 5000
        Send {Enter}
        Send {Alt down}{F4}
        Send {Alt up}

        return

        Comment


          #5
          Nice job. It may be more useful to use 1-min CSV data, then you have more options for creating multi-min charts based on 1-min data. Also, one can create a 1440 min (1-day) chart so that session breaks are not an issue if your daily bar length is session dependent. This will help "calculate" options.

          Cheers!

          Comment


            #6
            I don't do day trading. The time frame I mostly chart is Daily. Occasionally I'll chart 1 Hour, which is why I import 60min, not Daily prices.

            I mostly chart to have some idea of where my current PoS coins are going.

            ​​​​​​
            ​​​

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            6 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            41 views
            0 likes
            Last Post alifarahani  
            Working...
            X