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

Making a Path statement with a User Defined Input

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

    Making a Path statement with a User Defined Input

    I'm working with the StreamReader Sample and wanted to make the Path statement accept a user defined input.

    Thus in the SampleStreamReader example in the variables section is the declaration of the path:

    private string path = Cbi.Core.UserDataDir.ToString() + "MyTestFile.txt";

    I want to make "MyTestFile.txt" modifiable.

    I've been trying various things but nothing is working.

    Can someone help?

    Thank you
    taddypole...
    Last edited by Taddypole; 11-21-2012, 11:59 PM.

    #2
    Originally posted by Taddypole View Post
    I'm working with the StreamReader Sample and wanted to make the Path statement accept a user defined input.

    Thus in the SampleStreamReader example in the variables section is the declaration of the path:

    private string path = Cbi.Core.UserDataDir.ToString() + "MyTestFile.txt";

    I want to make "MyTestFile.txt" modifiable.

    I've been trying various things but nothing is working.

    Can someone help?

    Thank you
    taddypole...
    Code:
     
    private string fileName;
    private string path                 = Cbi.Core.UserDataDir.ToString()
    Code:
    path = path + this.FileName;
    Code:
     
    [Description("")]
    [GridCategory("Parameters")]
    public string FileName
    {
    get { return fileName; }
    set { fileName = value; }
    }

    Comment


      #3
      thank you koganam,

      I now have it working.
      Your help is much appreciated.

      ...taddypole

      Comment


        #4
        I now want to take this StreamReader to the next level by programmatically changing the file name based on today's date. The file I'm after is the log file created by NinjaTrader.

        I have most of the logic worked out but i'm having problems concatenating the path in this statement:

        if (File.Exists(path + fileName))


        It seems the above statement does not accept concatenation.

        Can someone shed some light on this one?

        thanks,
        taddypole...
        Attached Files
        Last edited by Taddypole; 11-30-2012, 02:17 PM.

        Comment


          #5
          never mind...

          if you try enough iterations, your bound to get it...

          here's the final solution...
          Attached Files

          Comment


            #6
            sorry, still have another bug, need to check for date change before updating the path. Otherwise is concatenates on each pass.

            out of time at the moment, will have to do this later...

            taddypole...

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by arvidvanstaey, Today, 02:19 PM
            4 responses
            10 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            56 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            8 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            47 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X