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

Scripts that aren't indicators or strategies

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

    Scripts that aren't indicators or strategies

    Hi

    I've recently imported around 20 years of historical intraday Forex data for 34 currency pairs, but I can't figure out a sensible way to run a statistical analysis of this data using NinjaTrader.

    For each currency pair, I need to loop through every bar, calculate some statistics and write the results to a text file for analysis in another application. This then needs to be repeated for 8 different time frames.

    I've already written some custom indicators for doing the calculations, but it's not obvious to me how I can use these in another script that is neither an indicator nor a strategy. From the NT documentation, it seems that I might be able to do what I need with a strategy, but only if I manually run it 34 x 8 times. Also, I can't figure out how to "page" through the historical data without loading it all at once, which I probably don't have enough Ram to handle. So, I would probably end up having to run the script several thousand times, then repeat this whenever I make a change!

    The obvious solution would be to use a script that does something like this:

    Code:
    - loop through instruments
      - loop though time frames
        - loop through data with x bars loaded in memory at any one time
          - do calculations
          - save data to text file
    I've already done this using Sharescope, but was limited by the fact that it doesn't allow you to import intraday history (and I'd rather not wait 20 years to accumulate enough data!), so I decided to switch to NT instead. So far, I've been very impressed and found it much more well suited to experienced software developers, but I'm beginning to worry that it lacks this simple feature. Please can someone tell me otherwise?

    Thanks

    Marcus

    #2
    marcus,

    This would be possible with a strategy, and you can load your instruments from a list.





    It would be complicated, however totally possible to make this work. Unfortunately specifics would be left up to you as this is unsupported functionality currently.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi Adam

      Thanks for the quick reply. The links you have provided just seem to be examples of reading and writing from a text file, which I had assumed would be a trivial operation anyway. Is there some other functionality in here that you wanted to demonstrate?

      I'd be very grateful if you could provide me with a few pointers on the other issues I raised. For example, how exactly do I retrieve data from NT's database, and how can I read the data as a stream, rather than by loading massive chunks into memory?

      Thanks

      Marcus

      Comment


        #4
        marcus,

        There is no supported way of reading from the NT database short of methods already setup in NinjaTrader. It is an SQL database however, so if you know what you are doing it would be possible to read from it. Unfortunately there would be no way I could help in this regard, however, due to the unsupported nature of it.

        Those links are meant to demonstrate how to read / write from a file. You could create a strategy that loads instrument and time frame strings into an array from a csv file. Then, you can loop through them, performing whatever methods you wish for your scanning.

        The main issue here is that you would need to add the time frames and instruments as dataseries, potentially having very many dataseries added to one strategy and very many OnBarUpdate() calls with separate BarsInProgress indices.

        There is an ATI interface you could use with a custom coded application outside of NinjaTrader : http://www.ninjatrader.com/support/h...?functions.htm

        If you already have an indicator developed, you could use the Market Analyzer. You just create a column with your indicator in it then you can add a whole list to the Market Analyzer and the indicator would calculate for each instrument.

        Let me know if you have any other questions.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Hi Adam

          I've been reading a lot of other threads and think I now have a better understanding of NT's support for custom development - and to be honest I'm a bit disappointed. On the one hand, the choice of a strongly-typed, object-oriented language like C# is clearly aimed at developers, but on the other hand you aren't exposing enough of NT's underlying libraries to allow developers the freedom they need.

          It looks like the only way forward is to use Visual Studio with various unsupported hacks, and to reverse-engineer the libraries myself. This is a lot more work than I had anticipated and, frustratingly, this could all be avoided if you just exposed and documented more of your code. Admittedly, if I had previous experience of Visual Studio (I'm an Eclipse and NetBeans user), I'm sure this would be a lot easier, but it's still very frustrating and just seems so unnecessary.

          In particular, I'd like the ability (as described below) to run scripts that are neither indicators nor strategies (in Sharescope, these are called "tools"). I'd also like access to the classes used for communicating with the database and populating the price objects.

          I hope you will forward this feedback to your developers.

          Thanks

          Marcus

          Comment


            #6
            Marcus,

            Thanks for your feedback. I will suggest this to development and get back to you.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              marcus,

              Your suggestion has ID : 588

              Please let me know if I may assist further.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Adam.

                One last question: Is there anywhere I can go to track progress on that suggestion ID, or will I be automatically informed of updates via my registered email address?

                Comment


                  #9
                  marcus,

                  Its internal tracking basically, so we don't currently update automatically. However you can always email us and check on the status.
                  Adam P.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi

                    Please can you provide me with an update on this issue?

                    Thanks

                    Marcus

                    Comment


                      #11
                      Marcus,

                      Unfortunately I don't have any new updates at this time other than there have been a couple more votes recently for similar items.
                      Adam P.NinjaTrader Customer Service

                      Comment


                        #12
                        Okay, thanks. Glad to hear I'm not the only one who would appreciate this feature.

                        Marcus

                        Comment


                          #13
                          Any news?

                          Hi

                          I still haven't found a developer-friendly platform that does everything I need, and it would be great if NinjaTrader could offer these features. Has there been any progress on this?

                          Thanks

                          Marcus

                          Comment


                            #14
                            Hello marcusjhdon,


                            Thank you for the follow up on this tracking ID.


                            I will check with development on this tracking ID and follow up with you on any updates here.
                            Ryan L.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello Marcus,


                              I have heard back from development and although we cannot provide anything concrete as of yet, however more developer support and documentation is planned for the next major upgrade of NinjaTrader. The exact level of which would not be set yet however.

                              Once we have feature sets and more defined schedule, we will make more announcements to the community.
                              Ryan L.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              179 views
                              0 likes
                              Last Post jeronymite  
                              Started by ghoul, Today, 06:02 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by DanielSanMartin, Yesterday, 02:37 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post DanielSanMartin  
                              Working...
                              X