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

display time and date

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

    display time and date

    How can I display the current time and date in the chart windows for example in the top left corner?

    Thanks!

    #2
    Hello Gregorio1980,

    I put together an indicator which will draw the current time in the upper left hand corner of the chart. Please see attached.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Alan! That is wonderful! Just how I wanted it!

      Comment


        #4
        Hello,
        This looks like it could solve my needs too - how do I go about compiling/importing this?
        Thank you!

        Comment


          #5
          Please disregard this, this is fine now. Thanks!

          Comment


            #6
            Hi AlanP,

            do you have a version properly working or another utility like this but working ? Because this one is not running with the last NT 8 release ( I franckly dont know with the previous ones...), I mean that when you start NT and opened a chart with this utility installed, you can read date and time but time doesn't update automatically, and time shown compared to the windows clock in the bottom right corner is back ( seconds don't update, and minutes update every 5 minutes ....)

            thanks in advance for your kind reply
            Best regards
            A.

            Comment


              #7
              Hello Alinghy,

              What you are describing would be the scope of what was provided in this sample, this specifically uses the PC clock time and only updates with the charts bar updates. It sounds like you are using a 5 minute chart if you are seeing this only update each 5 minutes.

              You can change the Calculate setting to OnEachTick if you would like to see more frequent updates, however this will still specifically reference the PC clock as that is what is programmed into the sample.

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Draw.TextFixed(#####);
                Use Time[0];

                Comment


                  #9
                  Originally posted by NinjaTrader_Jesse View Post
                  Hello Alinghy,

                  What you are describing would be the scope of what was provided in this sample, this specifically uses the PC clock time and only updates with the charts bar updates. It sounds like you are using a 5 minute chart if you are seeing this only update each 5 minutes.

                  You can change the Calculate setting to OnEachTick if you would like to see more frequent updates, however this will still specifically reference the PC clock as that is what is programmed into the sample.

                  I look forward to being of further assistance.
                  How can I have the time continuously updates regardless if charts are updating or not?
                  I am looking for a floating clock with seconds to place it on my workspace that updates continuously based on computer clock with seconds.
                  Any help is appreciated

                  Comment


                    #10
                    Hello GussJ,

                    For an indicator, there would not necessarily be anything I could suggest as this generally relies on some platform events to drive the rendering/script logic. If there is no data to drive the script it would just have to wait.

                    You could create an addon window if you want a floating clock in the workspace, in a window you can really do whatever you wanted. You could use a timer to update a text control as one possibility. You can find a sample window/addon in the following page: https://ninjatrader.com/support/help...t_overview.htm This would be considered general C#/WPF/Xaml development so most xaml tutorials can assist in understanding how the UI is built in this sample.

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      HELLO,
                      how can i increase the size ?

                      Comment


                        #12
                        Hello hir04068,

                        In this sample, Draw.TextFixed is used so this would default to the settings of the tool when not using an overload with a font. You can change the Draw.Text syntax in the script to use an overload that includes a font:

                        Code:
                        Draw.TextFixed(this, "tag1", DateTime.Now.ToString(), TextPosition.TopLeft, ChartControl.Properties.ChartText, [FONT=Helvetica]ChartControl.Properties.LabelFont, Brushes.Blue, Brushes.Transparent, 0); [/FONT]
                        Alternatively, you can replace the ChartControl.Properties.LabelFont with your own font: .
                        Code:
                        new SimpleFont("Arial", 12)
                        Please let me know if I may be of additional assistance.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          Hello, Quick question
                          with DateTime.Now.ToString() - it will print Date and time 6/3/2019 1:19:20 PM
                          is there a function that will only print the date? don't want time to be printed -like 6/3/2019
                          With ToDay(Time[0]) it is printing 20190603 --would like to have a separator like above
                          Thank you.

                          Comment


                            #14
                            Hello chalasani,

                            You can use a format with ToString for this purpose. You can find more infomration about DateTime formats in the public link here: https://www.c-sharpcorner.com/blogs/...p-programming1


                            Code:
                            Print(Time[0].ToString("MM/dd/yyyy"));
                            Please let me know if I may be of additional assistance.
                            JesseNinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by NinjaTrader_AlanP View Post
                              Hello Gregorio1980,

                              I put together an indicator which will draw the current time in the upper left hand corner of the chart. Please see attached.

                              Please let us know if you need further assistance.
                              Can you share the indicator again please, I see only a screenshot. Thank you !

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by frankthearm, Yesterday, 09:08 AM
                              14 responses
                              47 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by gentlebenthebear, Today, 01:30 AM
                              2 responses
                              13 views
                              0 likes
                              Last Post gentlebenthebear  
                              Started by Kaledus, Today, 01:29 PM
                              2 responses
                              8 views
                              0 likes
                              Last Post Kaledus
                              by Kaledus
                               
                              Started by PaulMohn, Today, 12:36 PM
                              2 responses
                              16 views
                              0 likes
                              Last Post PaulMohn  
                              Started by Conceptzx, 10-11-2022, 06:38 AM
                              2 responses
                              56 views
                              0 likes
                              Last Post PhillT
                              by PhillT
                               
                              Working...
                              X