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

current price - current time?

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

    current price - current time?

    Hello,

    because I´m experiencing issue with data in my charts as the bars are plotting often late (I only found out now since last upgrade it is possible to run NT on 2 computers) I want to ask if anyone has an idea how this could be surveyed to see if the time of plotting is the current time (its exhausting looking always for more instruments on 2 computers and read to compare the prices). I think like eg if there is a difference between PC-time and time of last bar with 1-minute/x-seconds/....it would plot gray backcolor or something like this. I know how to plot text or code brushes but I have no idea what would be the input.

    Thank you!
    Tony

    #2
    Hello tonynt,

    If you are having difficulties with data I would suggest trying to sync the PC clock on both PC's. If the clock is out of sync you may see data with incorrect times stamps. If that is not a solution please use the platforms help -> Email support option to connect with the support team so we can review the PC that is having a problem.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      thank you for your reply. I do sync every day both computers. I sent an email already to support and I got the reply that this might be caused because I have a 3rd party indicator with message that no valid license (I contacted the vendor and he said that has nothing to do with this when the license is not activated this moment on this computer). And the other suggestions were to reduce charts, indicators.... rebuild workspace, as usual, of course and I understand this is the way to go. I run 3 volumeprofiles for ES, YM, NQ and RTY each and those orderflowvolumeprofiles show a very high number in uty-monitor because of the 12 profiles running.

      All OK, but where is the tolerance? Is it 7 profiles or could it be 9 profiles with slower markets and should it be 5 only in fast markets or after open.......know what I mean?
      So the best in my opionion is to have something to survey so that I see when there is a discrepancy between current time (that I sync every day before open on both PC) and the time the bar/price is plotted. Can you give me an idea for the code or a snippet what I could catch to get this please.

      PS: my language is not english, if something sounds strange...

      Thank you for your support!
      Tony
      Last edited by tonynt; 08-18-2023, 02:17 PM. Reason: translation error

      Comment


        #4
        Hello tonynt,

        There is nothing that I could suggest here on the forum because I cannot confirm the versions used or any of your log/trace information. If you have a support ticket open and you are still seeing a problem please reply to that email and re open the case.

        There is no code to compare two pc's. If you are seeing a discrepancy you would need to contact support so we can address the problem directly instead of trying to suggest some sort of workaround.

        If you have vendor items that are no longer in trial and present a popup message you can remove those using the Tools -> Remove NinjaScript assembly menu.

        I would highly suggest to test by closing all workspaces so no third party items are running as well. If any third party items is causing a problem that would help to show if the platform is working normally or not.



        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello Jesse,

          is my english so bad? Did I write to compare 2 PC? Sorry, if I caused misunderstanding.

          I wanted to communicate that I see the difference in prices because now I can run NT on 2 computers. So from this I know now about the issue.

          Therefore I wrote "So the best in my opionion is to have something to survey so that I see when there is a discrepancy between current time .................and the time the bar/price is plotted. Can you give me an idea for the code or a snippet what I could catch to get this please." Of course to see discrepancy time of PC and time of bar plotted on the same computer!


          Thank you!
          Tony
          Last edited by tonynt; 08-22-2023, 07:11 AM. Reason: inaccurate translation

          Comment


            #6
            Hello tonynt,

            The same answer would apply, if you see a difference between 2 pcs (you are comparing them) then you should write into support about that. I can't recommend anything scripted to check that the two PC's are in sync.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello,

              I dont know whats wrong here after being NT customer 14 years. Forget about the 2nd computer!

              I do my question again: Is it possible in an indicator coding to compare computer time and plotted time of chart on one (1!) computer.

              I have a suspicion what will be now the reply.

              Comment


                #8
                Hello tonynt,

                You can print the PC time and also the Time[0] however the bar times relate to bar close times and won't be relevant to the PC clock.

                If you are seeing some discrepancy in data please make sure to contact support so we can review your log files to better understand the situation. You can do that by using the platforms email to support from the help menu.

                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Hello Jesse,

                  thank you for your reply. After the misunderstanding maybe with a snippet you can help me with my question.

                  Can you give me an idea how to have in NT code for printing the PC time please? Eg "if("TimeOfCloseOfBar" - "TimePC =....")". This would be help and I can continue on my side with what I need.

                  Thank you!
                  Tony
                  Last edited by tonynt; 08-23-2023, 10:52 AM. Reason: inaccurate translation

                  Comment


                    #10
                    Hello tonynt,

                    In C# you can access the PC time with DateTime.Now. You can learn about using the DateTime class in Microsofts C# documentation. https://learn.microsoft.com/en-us/do...ramework-4.8.1

                    I would still suggest using the platforms Help -> Email support option if you are seeing some kind of discrepancy with your data.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Hello Jesse,

                      thank you for your reply!

                      With this hint I found out how I can plot the pc time and in NT forum I found to get the time of barclose. And I can run it also for other dataseries eg 30 seconds and its plotted in my tick-chart. And I found in the web how to calculate the difference! Great!

                      But I can´t find how to round the timedifference it so that the ,xxxxx is not visible after the seconds, and I can not work with the timedifference eg like "if timediff> 5 (seconds) Backbrush.Cyan" (or any other action that shows me immediately that there is a difference). I always get error messages about timespan and int. I understand why the errormessage is but I can´t resolve it.

                      In the attached screenshot I show the difference with 00:00:01.xxxxxxxxxxxxxx

                      Thank you for helping me to make it working with that final step.

                      Tony
                      Attached Files
                      Last edited by tonynt; 08-24-2023, 04:36 AM.

                      Comment


                        #12
                        Hello tonynt,

                        You can learn about using DateTime objects in Microsofts documentation or by doing google searches. https://learn.microsoft.com/en-us/do...ramework-4.8.1

                        You would need to format the string to change the way a string is displayed.

                        To do comparisons with greater or lesser you would need to compare two DateTime objects against each other.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          yes, of course,and this is what I am asking. Going over now again for hours but I dont find (or understand) how to plot my calculations without that tail of numbers after seconds.

                          Comment


                            #14
                            Hello tonynt,

                            To format a DateTime you need to use ToString to change the format, you can find some example online by searching for "C# format a datetime string: MSDN has an article for this as well. https://learn.microsoft.com/en-us/do...format-strings
                            JesseNinjaTrader Customer Service

                            Comment


                              #15
                              Hello Jesse,

                              I have been there and read it. But I dont understand how to use this console and parse in my ninjascript.

                              From my work with indicator scripts I know how to use new DateTime... and Time[0].TimeOfDay...and timespan but I dont understand this write console parse.
                              Cant you give me those 3 "words" maybe? I´m too old to learn all this because I miss just a snippet.


                              Thank you!
                              Tony

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Trader146, Today, 11:41 AM
                              0 responses
                              0 views
                              0 likes
                              Last Post Trader146  
                              Started by jpapa, 04-23-2024, 07:22 AM
                              2 responses
                              16 views
                              0 likes
                              Last Post rene69851  
                              Started by funk10101, Today, 11:35 AM
                              0 responses
                              0 views
                              0 likes
                              Last Post funk10101  
                              Started by samish18, Today, 11:26 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post samish18  
                              Started by Trader146, 03-29-2024, 01:22 PM
                              2 responses
                              14 views
                              0 likes
                              Last Post Trader146  
                              Working...
                              X