Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Read Economic Calendar from a CSV file and Use in a Strategy

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

    Read Economic Calendar from a CSV file and Use in a Strategy

    Hi,

    I have the weekly Economic Calendar (which I download from fxstreet) in a csv format (sample attached) and I would like to incorporate that information into my NT8 strategy to close open positions one minute before the announcement.

    I tried using Chat GPT but couldn't get any where, went thru the forum but couldn't find what I need.

    Can someone share a sample code that shows how to import a multiple row data from a CSV file, and more importantly how to consume that information in a strategy. I think many people would find this solution quite useful.

    Thanks
    M
    Attached Files

    #2
    Hello mntemel,

    You can find a sample of parsing a csv file in the following link. This sample uses OHLC data but you could still learn how to open and read a file by using that sample. https://ninjatrader.com/support/help...o_read_fro.htm

    Reading data from file is not going to be a NinjaScript specific task so you will likely find better resources by searching online for "C# read and parse a csv file" to get some examples of doing tasks with csv files. You would have to modify the code to accommodate the data you want to use and then make logic that uses the parsed data for the purpose you wanted.

    As a side note chatgpt does not have the context at this point to make valid NinjaScript code so using that is often not very helpful and may lead to bad suggestions.

    Comment


      #3
      @NinjaTrader_Jesse​ thanks for sharing this solution, looking into it the external documentation links seem to be broken, you guys might wanna update them.

      Comment


        #4
        Hello mntemel,

        The link I provided is valid and I see it working. If you mean external by searching online that is not something NinjaTrader controls, the internet has many C# resources that you can learn different topics from.

        Comment


          #5
          @NinjaTrader_Jesse​ I meant the links in the below screenshot, it was just a feedback to improve the Ninjascript documentation.​

          Comment


            #6
            Hello mntemel,

            There was no screenshot attached so I am not sure what links you are referring to. If you are having trouble with a NinjaTrader resource I can report that but I would need to know the specific page you are looking at.

            Comment


              #7
              @NinjaTrader_Jesse​ trying to share the screenshot again

              Click image for larger version

Name:	reader.jpg
Views:	322
Size:	203.3 KB
ID:	1248475

              Comment


                #8
                Bruce DeVault
                QuantKey Trading Vendor Services
                NinjaTrader Ecosystem Vendor - QuantKey

                Comment


                  #9
                  Hello mntemel,

                  Thanks for providing that, it looks like Microsoft changed those pages. I will go ahead and report that.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Today, 05:17 AM
                  0 responses
                  32 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  124 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  64 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  41 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  46 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X