Announcement

Collapse
No announcement yet.

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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            157 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            91 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            143 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            130 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X