Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Display of Version Data for a User Generated Indicator or Strategy

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

    Display of Version Data for a User Generated Indicator or Strategy

    Yesterday I got mixed up while debugging, because I had the wrong version of an indicator on my test system.

    So, I decided to build something into the indicator to display the current version number and the build date & time, like I do with other applications written in C++ on other platforms.

    And I found that C# has no simple equivalent to the C++ built-in constants of "__DATE__" and "__TIME__", which will very simply put string values containing the date & time that the last build was done into the object file generated by the compiler.

    But, after much searching (I thought this project was going to take 12 seconds, boy was I wrong), I found the following code that's supposed to display the version number and date and time of a C# Assembly:

    Code:
    System.Reflection.Assembly assem = System.Reflection.Assembly.GetExecutingAssembly();	// Get a pointer to the assembly for the current routine.
    Version vers = assem.GetName().Version;							// Get the version of that assembly.
    DateTime buildDate = new DateTime(2000, 1, 1).AddDays(vers.Build).AddSeconds(vers.Revision * 2); // Build time is relative to 1/1/2000
    Print( "Version=" + vers.ToString() + " DateString=" + buildDate.ToString() );		// Display message in NinjaTrader's Output window.
    However, what it displays has nothing to do with the indicator I'm developing. It displays the following in the Output window:

    Version=6.0.1000.4 DateString=9/27/2002 12:00:08 AM
    Since the version number is that of NinjaTrader, I'd expect the date to somehow or other be related, but its not.

    What I really want is what C++ provides... that the compiler embeds the date & time information into its output file, so that when I run the program, the program can display the time that it was last built.

    Is there any way that I can display the time of the last compile of my indicator or strategy?

    If not, would you consider adding something like this in the future? (i.e., embedding the compile date & time into each indicator and strategy module and providing a way to reference it at runtime as a Double or String or DateTime)

    #2
    >> Is there any way that I can display the time of the last compile of my indicator or strategy?
    Sorry, I would not know.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sidlercom80, 10-28-2023, 08:49 AM
    166 responses
    2,234 views
    0 likes
    Last Post sidlercom80  
    Started by thread, Yesterday, 11:58 PM
    0 responses
    1 view
    0 likes
    Last Post thread
    by thread
     
    Started by jclose, Yesterday, 09:37 PM
    0 responses
    6 views
    0 likes
    Last Post jclose
    by jclose
     
    Started by WeyldFalcon, 08-07-2020, 06:13 AM
    10 responses
    1,414 views
    0 likes
    Last Post Traderontheroad  
    Started by firefoxforum12, Yesterday, 08:53 PM
    0 responses
    11 views
    0 likes
    Last Post firefoxforum12  
    Working...
    X