• 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

Get Indicator Input from Excel

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

    Get Indicator Input from Excel

    I have an indicator I use on multiple charts that requires manual inputs regularly. Now I have to make these entries separately for each chart.

    What I would like to do is to make th entries once into a simple Excel sheet (one column, two or three entries) and have the indicator read those for all charts (simply by Reloading NinjaScript).

    What is the simplest code to make the spreadsheet accessible and then to read the cells I need?

    Or is there another way to do this?

    #2
    Hi,

    Unfortunately, this is outside the scope of what we can support. However, since NinjaScript is C#, you could likely accomplish what you want. Just have to google for it. I would likely take a different approach and just read in a text file that contains these values. If you start creating objects that have scope over the lifetime of an indicator, be sure to clean up these resources in the Dispose() method.

    http://www.ninjatrader-support.com/H...6/Dispose.html
    RayNinjaTrader Customer Service

    Comment


      #3
      A text file would be fine with me -- I'm looking for the simplest way. How would I do that?

      Comment


        #4
        You will need to google for resources and samples on reading/writing to text files in .NET.

        Google and search this forum for references to StreamReader and StreamWriter.
        RayNinjaTrader Customer Service

        Comment


          #5
          An example of reading from a file

          I'm not an experienced program but here is how I read some values from a file:

          First, I added a line to the Using declarations (using System.IO:

          #region Using declarations
          using System;
          using System.ComponentModel;
          using System.Diagnostics;
          using System.Drawing;
          using System.Drawing.Drawing2D;
          using System.Xml.Serialization;
          using NinjaTrader.Cbi;
          using NinjaTrader.Data;
          using NinjaTrader.Indicator;
          using NinjaTrader.Strategy;
          //added by me
          using System.IO;
          #endregion

          Then, I added the attached code to OnBarUpdate to read four values from a file and convert to doubles.
          You are interested in the try and catch section. The part before that is specific to my code.

          Folls
          Attached Files

          Comment


            #6
            Thanks for the contribution Folls.

            We will publish some official reference files for File I/O by the end of next week.
            RayNinjaTrader Customer Service

            Comment


              #7
              Thank you Folls, I'll work on this.

              And I'm looking forward to the new reference files. How will I find them?

              Comment


                #8
                They will be posted in this section.

                http://www.ninjatrader-support.com/v...splay.php?f=29
                RayNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by oscsoft, Today, 07:07 PM
                0 responses
                6 views
                0 likes
                Last Post oscsoft
                by oscsoft
                 
                Started by PanicTrades, Today, 07:01 PM
                0 responses
                13 views
                0 likes
                Last Post PanicTrades  
                Started by dedouglas, Today, 03:38 PM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_ShawnB  
                Started by aligator, Today, 03:20 PM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by aramtrader, Today, 03:05 PM
                2 responses
                17 views
                0 likes
                Last Post aramtrader  
                Working...
                X