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 Waxavi, Today, 02:10 AM
        0 responses
        6 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        11 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        4 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        5 views
        0 likes
        Last Post gentlebenthebear  
        Working...
        X