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 bmartz, 03-12-2024, 06:12 AM
    4 responses
    31 views
    0 likes
    Last Post bmartz
    by bmartz
     
    Started by Aviram Y, Today, 05:29 AM
    4 responses
    11 views
    0 likes
    Last Post Aviram Y  
    Started by algospoke, 04-17-2024, 06:40 PM
    3 responses
    28 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by gentlebenthebear, Today, 01:30 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by cls71, Today, 04:45 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X