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

Stuck at 130000 in current time

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

    Stuck at 130000 in current time

    Hello,

    I am stumped. The current time is stuck at 310000, no updating time. I checked my computer's system time and it is current. Does it have something to do with internet time or computer system itself? Thanks for your help!

    See attached picture and simple code here:

    Code:
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion
    
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
        public class ShowTime : Strategy
        {
            #region Variables
            #endregion
    
            protected override void Initialize()
            {
                CalculateOnBarClose = false;
            }
    
            protected override void OnBarUpdate()
            {
    		DrawTextFixed("time", "Current Time: " + ToTime(Time[0]),
    		TextPosition.TopLeft,Color.LimeGreen,new Font("Arial", 20),Color.Black,Color.Black,10);
            }
    
            #region Properties
            #endregion
        }
    }
    Attached Files

    #2
    Traderjh,

    Thank you for your post.

    This is because Time[0] is grabbing the most current bars time stamp and not the PC clock time.
    You will need to use a DateTime object in this place instead. Since, you have a 60m chart, the current bar time stamp will show the end of that bars' time.

    http://www.ninjatrader.com/support/h...ries_class.htm

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Brevo, Today, 01:45 AM
    0 responses
    6 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    3 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    384 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    6 views
    0 likes
    Last Post oviejo
    by oviejo
     
    Working...
    X