Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using System.Globalization.CultureInfo.InvariantCulture

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

    Using System.Globalization.CultureInfo.InvariantCulture

    HI i have a code that loops through DrawObjects, i have something like this

    if (draw is DrawingTools.Rectangle)
    {
    DrawingTools.Rectangle RectangleTemp = draw as DrawingTools.Rectangle;
    RectangleTag = draw.Tag;
    RectangleStartPrice = RectangleTemp.StartAnchor.Price;
    RectangleEndPrice = RectangleTemp.EndAnchor.Price;
    RectangleStartTime = RectangleTemp.StartAnchor.Time;
    RectangleEndTime = RectangleTemp.EndAnchor.Time;
    s.WriteLine("@NQ#BOX" + ";" + RectangleStartTime + ";" + RectangleStartPrice + ";" + RectangleEndTime + ";" + RectangleEndPrice + ";" + ChartPeriod); // Append a new line to the file
    }


    i see this sample

    DateTime AsiaSessionTime = DateTime.Parse("17:00", System.Globalization.CultureInfo.InvariantCulture) ;
    DateTime EuropeSessionTime = DateTime.Parse("02:00", System.Globalization.CultureInfo.InvariantCulture) ;

    how can i use it in the code for example

    RectangleEndTime = DateTime.Parse((RectangleTemp.EndAnchor.Time), System.Globalization.CultureInfo.InvariantCulture) ;​

    #2
    Hello MJGutierrez,

    Thanks for your post.

    Using DateTime.Parse() would be considered C# education services which would go beyond the level of support we would be able to provide.

    See this publicly available documentation for information about using the DateTime.Parse() method: https://learn.microsoft.com/en-us/do...e?view=net-7.0

    <ChartAnchor>.EndAnchor.Time will return a DateTime value that contains a Date, such as 10/26/2022, and a Time, such as 6:55:00 PM.

    Let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    156 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    90 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    140 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