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

Output file name with StreamWriter

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

    Output file name with StreamWriter

    Hi,
    (1) I've benefited a lot from NT StreamWriter. Thank you so much.
    (2) I've created private string path2 = "D:\\data\\CL30Minute.txt"; to store the text.
    (3) I'm more concerned about daily intra day values.How could I append the current date automatically to the file name by adding some codes within your script? ( The output file name will then looks like 20101228CL30Minute.txt ; 20101229CL30Minute.txt etc )
    Thanks and Happy New Year To all NT staffs.
    Last edited by m. khalid; 12-29-2010, 11:59 AM.

    #2
    Hello m. khalid,

    We're glad you find this utility useful. You can use DateTime.Now to pull the current system time.

    If you just wanted the day portion of this, can use ToDay(DateTime.Now)
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hello RyanM,
      (1) ToDay(DateTime.Now) seems like returning the current date.
      (2) What if my DataSeries start date is set to 2010-11-23, I'd like the date to return as 20101123 as well? Thanks.

      Comment


        #4
        If you'd like to return the time from your chart's time stamp, you can use ToDay (Time[0])

        If you want to capture this on the first bar:

        if (CurrentBar == 0)
        double myStartDate = ToDay (Time[0]);
        Last edited by NinjaTrader_RyanM1; 12-29-2010, 02:20 PM.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Today, 12:02 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by GLFX005, Today, 03:23 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by nandhumca, Yesterday, 03:41 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by The_Sec, Yesterday, 03:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by vecnopus, Today, 06:15 AM
        0 responses
        1 view
        0 likes
        Last Post vecnopus  
        Working...
        X