• 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

Write to a file

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

    Write to a file

    I would like to create a file and write to it from a strategy, is that possible? I've found examples for indicators but not strategies.

    Is there a unique number to identify each position? If so, how do I get that # in Ninjascript?

    Thanks!!

    #2
    Hello mrmistermike2016, and thank you for your question. For File I/O, you will need to use MSDN's built-in C# functionality. Here is some publicly available documentation on File I/O and, if you intend to read this data in a spreadsheet, some publicly available documentation for CSV methods as well.

    https://msdn.microsoft.com/en-us/library/k3352a4t.aspx
    http://stackoverflow.com/questions/3...-using-c-sharp (David Pokluda's answer regarding using the Visual Basic CSV implementation from C#)

    Is there a unique number to identify each position?
    You as a user can

    • create a Dictionary<long, Position>
    • implement an OnPositionUpdate method
    • use the (linked documentation publicly available) MSDN C# UUID method to create a unique ID for each position
    • use this unique ID as your Dictionary key, and your Position object as its value

    Please let us know if there are any other ways we can help
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      This doesn't make sense to me. So if I have an issue with a position and I need to discuss it with my broker, what information do I give them?

      How do I request/suggest this enhancement in a newer version? I can't believe I'm the only trader that would find this information useful.

      Thanks!!

      Comment


        #4
        Since I am more of a technical support specialist I have contacted a colleague of mine who can discuss your options as far as consulting with a NinjaScript specialist who can configure your strategy with the functionality I outlined.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Hello mrmistermike2016,

          This is Ryan L. from the NinjaTrader Ecosystem responding on behalf of my colleague Jessica.

          You can search our extensive library of NinjaScript consultants for any custom strategy work for use within NinjaTrader through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more!

          This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

          Please let me know if you have any questions, concerns or if I can provide any further assistance by responding to this thread at your convenience.
          Ryan L.NinjaTrader Customer Service

          Comment


            #6
            Hey Ryan, I don't need a Ninjascript consultant. I have been programming for years and I have a slew of colleagues with C# experience. My question is regarding the Position ID and can I access it or not in Ninjascript?

            I spoke to the team at Forex.Com and all positions and orders have unique IDs. Why can't I see it like I can the open price, position type, etc? Somehow behind the scene Ninjatrader has to connect to the right position and order at the broker. How is that done?

            Thanks!!

            Comment


              #7
              I believe there was a miscommunication. If you are not asking how to implement File I/O, and based on your most recent post, I believe you may be referring to an Order ID. That information can be retrieved from OnOrderUpdate. The passed-in order object has a unique OrderID. This information as well as information regarding the order type, entry price, and others is made available here as well. This documentation has more information.

              Order objects : http://ninjatrader.com/support/helpG...n-us/order.htm
              OnOrderUpdate (contains a code example) : http://ninjatrader.com/support/helpG...rderupdate.htm

              Position in NinjaScript usually refers to e.g. "3 deep on the long side of the market". Tracking when that sort of Position had occurred uniquely is something a user will need to do. However, the method used to enter a Position is usually referred to as an Order, and these are indeed automatically assigned tracking IDs.

              I hope this clears up the situation, and the way I had interpreted your request. Please let us know if there are any other ways we can help.
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Jessica. I'll work in it and let you know.

                Thanks!!

                Comment


                  #9
                  Wrong thread!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by joemiller, Today, 07:33 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post joemiller  
                  Started by isnercrypto, Today, 06:42 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post isnercrypto  
                  Started by Coursocied67, Today, 04:02 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post Coursocied67  
                  Started by TheGameOfProbabilities, 07-18-2019, 06:56 AM
                  7 responses
                  37 views
                  0 likes
                  Last Post DaveS
                  by DaveS
                   
                  Started by claxxical, Yesterday, 10:00 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post claxxical  
                  Working...
                  X