Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What is the best practice way to run NT8 live while simultaneously doing dev work?

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

    What is the best practice way to run NT8 live while simultaneously doing dev work?

    I want to make money with a "released" version of my code by running it all day. At the same time, I want to keep developing my trading engine, making changes, debugging etc. on the next version.

    Does that require two NT8 keys? I note that when I login on a 2nd machine with the same key it tells me I need to shut down NT8 on the 1st machine.​

    #2
    Hello carnitron,

    As long as you are doing the development work on the same computer that is running the live strategies you do not need two licenses.

    You only need to licenses if you are using two different computers. (Meaning use the same computer)

    If you need to use a second computer, you can either use the Simulation Only license or you can purchase a second license key. (Send an email to platformsales [at] ninjatrader [dot] com if you need either)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Ok, I think maybe two licenses is where I'm going to end up, and maybe more, depending on how profitable I am.

      These are the problems I see with developing and running on the same machine:

      01 I'm not aware of a way to simultaneously, on the same machine, run NT8 with version A of my code while I run another NT8 with version B of my code. Is this actually possible?

      02 Currently, when I am running while I develop, if an exception happens, it drops me into the newer version of my code that I am editing, which naturally doesn't match the code NT8 is running for live. This means breakpoints don't work, and I cannot step through and see what is happening. Is there a workaround for this?

      Comment


        #4
        I am also developing while trading, but I haven't experienced the problems you are describing. Maybe because I use different strategy names for my "live" version vs. my "dev" version? My live account & strategy run in one chart, and I'm using strategy analyzer on the dev version (with a different name).

        However, I am having this problem: Whenever I hit a breakpoint in the debugger, the whole NT app stops. I think this is normal, but it's a problem when live trading. Does the free sim version support strategy development?

        Comment


          #5
          Yeah, technically the breakpoint freezing NT8 issue you mention is an even worse problem to the extent that it might trash a live trade. I'm not actually sure what NT8 does here, but it is probably somewhat situational. Active stops that made it to the broker would theoretically still fire, but I don't know if strategies A and B are each handled on different threads, such that if you are in the debugger on A, then B can still continue running in the background.

          My case is a little more complicated, b/c I have an Add On where I know that hitting break points in certain places are guaranteed to halt parts of my code that need to run in order to successfully respond to market events.

          One of the core issues here is that NT8 only allows one instance to run on a machine at a time. So to be genuinely safe from breakpoint and halting thread issues, you must have two machines, one running live, and the other where you do dev work. I think my next step is to explore running with a sim key on the 2nd machine.

          Comment


            #6
            Hello carnitron,

            01 I'm not aware of a way to simultaneously, on the same machine, run NT8 with version A of my code while I run another NT8 with version B of my code. Is this actually possible?
            You can run two or more strategies at the same time, even on different accounts (like one live and one sim). The strategies would have different names.

            02 Currently, when I am running while I develop, if an exception happens, it drops me into the newer version of my code that I am editing, which naturally doesn't match the code NT8 is running for live. This means breakpoints don't work, and I cannot step through and see what is happening. Is there a workaround for this?
            By default NinjaTrader will disable the strategy and put the error on the Log tab of the Control Center. (If you are using a try and catch, this will prevent NinjaTrader from disabling and logging the error.
            If a script is compiled and then reloaded, it will be running the code that was compiled.
            Breakpoints are not available in NinjaTrader, but you might be attaching VisualStudio for debugging, which will complete stop the NinjaTrader process.
            You could use prints and debug in the NinjaScript Editor instead.

            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Interesting. Thanks for the info.

              For better worse, I have written a full on trading engine that uses the AddOn API to both ingest market data and make decisions on when to trade where. I don't actually have any strategies. And, yes, I do basically all of my development in Visual Studio.

              But maybe using a strategy as a thin proxy against my trading engine would produce some benefits here. It doesn't seem like it, b/c I intentionally have all the important logic out in a DLL, where I can use the full might of Visual Studio for debugging. But I don't know what I don't know. Perhaps I will experiment here in the future just to see if it produces any insights.

              I suspect I will have to transition to dual key and dual machine at some point here, but I'm not quite sure when yet.​

              Comment


                #8
                Hello carnitron,

                The API requires to you specify the account the order is being submitted to.
                int Command(string command, string account, string instrument, string action, int quantity, string orderType, double limitPrice, double stopPrice,
                string timeInForce, string oco, string orderId, string strategy, string strategyId)

                https://ninjatrader.com/support/help.../functions.htm

                From an external application any debugging would be for that external application. The debugging would not be done in NinjaTrader.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Technically I think what I have is a complicated Add On, given that it is an NT8 AddOn that uses two DLLs that I provide. I am not creating an EXE, so I don't want to give the misimpression that I'm creating a standalone application here.

                  There are a variety of reasons I've done things this way, including needing to work with multiple tickers at once, wanting to leverage more modern versions of C#, and needing to multithread my code so I can squeeze ever last bit of perf out of my box.

                  While debugging via log statement is one of my favorite debugging techniques, in that it works anywhere and can be used to stop almost any bug, there are definitely faster techniques in modern development environments for many of the mainstream cases. So that also plays a role in going with Visual Studio.

                  When the time comes, I will investigate the best way to handling differentiating between accounts, and your API suggestion here is helpful in that regard, b/c it means it might be possible/useful to pass account info in from appSettings (given that I'm not publishing this as a 3rd party product and don't necessarily have worry about security as much for the time being).

                  Either way, thanks for all of your help, Chelsea. Cheers.

                  Comment


                    #10
                    Hello carnitron,

                    The API can only be used with an external application.

                    Native NinjaScripts, such as Addons, Strategies, and Indicators, do not use the API (Application Programming Interface).

                    Below is a link to a forum post on the API.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Whoa, I did not even realize that was a thing. Interesting! I will have to ponder this. For the moment (and maybe/hopefully? for good) I am pretty happy with using NT8 as sort of a host environment for my trading engine, since it gives me all sorts of stuff for free. Like charts, indicators, order management etc. Overall it's an amazing tool build around a great concept - it's kind of like Visual Studio for Traders in a way. Now that I've spent quality time developing in this space, my mind is full of ideas for how retail could benefit from a more software-based approach.

                      I used to use BookMap, which is essentially a heat map for the Order Book. It's an awesome idea, and basically blew the doors off the usual order book displays for fast decision making. I paid $119/month for that, but will at some point write my own in NT8 since it seems like this could be pretty straightforward, and it will be free once I'm done, lol.
                      Last edited by carnitron; 02-06-2023, 02:50 PM.

                      Comment


                        #12
                        I'd suggest loading VM software (such as VirtualBox or HyperV) and
                        run your live trading on the real hardware and do your development
                        on the virtual hardware. Good reading here and here.

                        The VM will require you install a copy of Windows, as well as a copy
                        of NinjaTrader, and, yeah, you 'd have to install Visual Studio on the
                        VM as well.

                        Since this is all running on the same PC hardware, perhaps you could
                        use the same NT license key for both NinjaTrader installations.

                        Your main issue is:
                        You cannot connect to the same data feed on both NT instances at the
                        same time, unless you pay extra for that benefit (Rithmic has this option,
                        I think). But this can be solved by subscribing to an eval account at a
                        prop firm that regularly puts their evaluation subscription accts on sale.

                        For ex, Leeloo is having a sale right now (ends today) where their
                        150K eval acct is 80% off for lifetime of the acct. They have a regular
                        size and smaller 'LE' brand, which has more restrictions but is cheaper.

                        The point is:
                        Look closely, the 150K 'LE' eval acct is on sale for a mere $14 per
                        month! But don't trade the account, just use the data feed and
                        stay in Sim101 forever -- that is, you're paying $14/mo for access
                        to the real-time data
                        , not for the trading of the account. Leeloo has
                        no inactivity fee, just pay the $14/mo, then stay in Global Simulation
                        Mode forever. You're not trying to pass the eval, you're using the
                        cheap real-time data + access to historical data -- it's all part of the
                        cost of being a developer, it's just a business expense.

                        Yes, $14/mo (or even $30/mo) is not bad ... but wait, there's more!

                        These prop firms typically use Rithmic connections, which provide
                        lots of historical data, because Rithmic connections will use NT's
                        own historical data servers,
                        • historical tick data - 1 year
                        • historical minute/day data - usually 10+ years
                        • playback data - 90 days​ - Futures and Forex instruments only
                        ​I've seen great sales at Apex, Leeloo, and Bulenox, at up to 70% or
                        80% off the monthly fee, for the life of the acct. Find a sale, subscribe
                        to a cheap eval acct, pay the monthly fee, get a real-time data feed
                        plus get a reasonably large amount of historical data -- these sales
                        are the best way to get access to a 2nd real-time and historical data
                        feed for the development on your VM -- very inexpensive!

                        Why go to to all this trouble?
                        Development on a free VM+cheap data feed from prop firm equals
                        absolutely no interference with your live trading, and you don't need
                        a 2nd NinjaTrader license key (your prop firm will probably give you
                        one for free if you do).

                        Very sweet setup!

                        After that, you now have a true 'production' machine and a 'development'
                        machine -- all on the same physical box. Moving your development DLLs
                        to production (after hours, which is another best s/w eng practice) gives
                        you complete separation in the DLL install/migration process as well.

                        Good luck!

                        Last edited by bltdavid; 02-07-2023, 03:16 AM. Reason: Added additional 'good reading' link for VirtualBox.

                        Comment


                          #13
                          Wow, that is exceedingly helpful advice there, thank you bltdavid ! Ok, I'm going to try your recommendations first. That is a LOT less expensive and would be a good learning experience too. :

                          Comment


                            #14
                            Originally posted by carnitron View Post
                            That is a LOT less expensive and would be a good learning experience too
                            From Leeloo's email:
                            "80% off CEO SPECIAL discount on the LL $150k and LE $150k
                            use code: ESUADPPF up to 10 per trader. Ends Monday Night!"


                            EDIT:
                            Email Leeloo​ for a link to their 'LE' 150K purchase page if you wish
                            to use that code -- after tax, it came out to a little over $15/mo for
                            me -- but you must email them and ask about buying the 'LE' acct,
                            apparently, it is not shown on their standard purchasing page.
                            Last edited by bltdavid; 02-06-2023, 03:48 PM.

                            Comment


                              #15
                              Go find the YouTube channels for Leeloo, Apex, and Bulenox, and
                              subscribe to them right now. The best sales are sometimes called
                              'flash sales' -- they don't last long -- but they seem to announce the
                              details via videos and emails (but Leeloo seems to be more videos
                              than emails).

                              Remember:
                              This is all in the pursuit of a cheap real-time data feed, in no way
                              am I promoting anything to do with their prop firm or trader funding
                              business side. This is all about the data.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by usazencort, Today, 01:16 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post usazencort  
                              Started by kaywai, 09-01-2023, 08:44 PM
                              5 responses
                              603 views
                              0 likes
                              Last Post NinjaTrader_Jason  
                              Started by xiinteractive, 04-09-2024, 08:08 AM
                              6 responses
                              22 views
                              0 likes
                              Last Post xiinteractive  
                              Started by Pattontje, Yesterday, 02:10 PM
                              2 responses
                              21 views
                              0 likes
                              Last Post Pattontje  
                              Started by flybuzz, 04-21-2024, 04:07 PM
                              17 responses
                              230 views
                              0 likes
                              Last Post TradingLoss  
                              Working...
                              X