Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Code not working on NT8

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

    Code not working on NT8

    Hello,

    This piece of code worked perfectly on NT7:

    string fileName2 = @"T:\LogsNT8\MyFile.txt" ;
    FileInfo f_info2 = new FileInfo( fileName2 );

    if (f_info2.Exists)
    f_info2.Delete();


    Why not in NT8?

    #2
    Hello guillembm,

    Thanks for your post.

    Without further information about what is not working, such as error messages, I will speculate that you would need to add "using System.IO; " to the region "Using Directives" at the top of the file. Normally indicators/strategies do not include this library.

    Comment


      #3
      I already included it.

      #region Using declarations
      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.ComponentModel.DataAnnotations;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Gui;
      using NinjaTrader.Gui.Chart;
      using NinjaTrader.Gui.SuperDom;
      using NinjaTrader.Data;
      using NinjaTrader.NinjaScript;
      using NinjaTrader.Core.FloatingPoint;
      using NinjaTrader.NinjaScript.Indicators;
      using NinjaTrader.NinjaScript.DrawingTools;
      using System.Security.Cryptography;
      using System.IO;
      using System.Diagnostics;
      using System.Windows.Forms;
      #endregion

      DId you try to reproduce it?

      Comment


        #4
        Hello guillembm,

        Thanks for your reply.

        Can you clarify if you are getting compilation errors or run time errors or further identify what is not working here?

        Comment


          #5
          It's not a compilation error. Actually no errors appear. I just doesn't find the specified file.

          Comment


            #6
            Hello guillembm,

            Thanks for your reply.

            The code works fine on my end, of course I had to change the file path for my system.

            Can you test to be sure the file is in the expected location?

            Print (new FileInfo(@"T:\LogsNT8\MyFile.txt").Exists ? "File is there" : "File does not exist");

            Comment


              #7
              OK Thanks.

              I was executing the 32 bit version. After switching to 64 bit it works

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              65 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              41 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              23 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              26 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              52 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X