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

Print(ToTime(Time[0]));

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

    Print(ToTime(Time[0]));

    what would cause this to print the wrong value.
    it is currently 11.20pm where i am
    when i run this function it is showing 50000 (500am)

    #2
    Hello fiddy,

    Using Print(ToTime(Time[0])) prints the time of the bars on the chart as integers. This does not print the current time.

    Is this the last appearing print in the output window?

    What is the time of the last bar on the chart?


    If you want to find the current time use DateTime.Now on a live account or use Bars.MarketData.Connection.Now if in market replay.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      i am using the following as part of strategy

      if ((ToTime(Time[0]) >= 220000 && ToTime(Time[0]) <= 240000))

      for some reason it wasnt triggering so i used the Print(ToTime(Time[0])) to find out what time was printing .

      the time doesnt match up to my current time

      what should i be using for this

      Comment


        #4
        Hello fiddy,

        That print should be printing more that one bar, it should be printing for every bar.

        Did you only receive one print in the output window?

        Can you include the full output?

        Can I see a screenshot of the chart?

        Is the Print(ToTime(Time[0])) call inside of a condition?

        The time filter in your post would trigger an action if the time is 10 PM or after and before or at 12:00 AM and is written correctly.

        The Print(ToTime(Time[0])) is printing the time of the bar. What bar is on the chart?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          it is printing for every bar.
          the time where i am is 232000 so the condition should have been triggering

          the issue seems to relate to my recent connection to interactive brokers
          i was having problem with data for some instruments so was given the following msg to follow:


          i followed the instructions from the msg but data doesnt seem to be coming through correctly. data has only updated up to yesterday close, no live data is coming thru.

          Comment


            #6
            the data is coming thru but it is not coming thru live.
            the data doesnt update unless i change the time period on the chart - then it updates
            how do i get the data to come thru live

            Comment


              #7
              Hello fiddy,

              Not all instruments are on the Nasdaq exchange. The exchange checked needs to match the instrument settings in TWS.

              Add this intrument to a row in TWS. Then right-click the row -> select Contract Info -> Description.

              Use check the exchange listed for the instrument in the Description.

              If the exchange is marked as SMART, add |SMART to the symbol mapping.

              I've created a short video to demonstrate.
              http://screencast.com/t/yN24GG3IXo

              If you would like assistance setting up the instrument correctly, please send an email to platformsupport [at] ninjatrader [dot] com. In the email, please include a link to this forum thread.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rjbtrade1, 11-30-2023, 04:38 PM
              2 responses
              75 views
              0 likes
              Last Post DavidHP
              by DavidHP
               
              Started by Stanfillirenfro, Today, 07:23 AM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by FitSpressoHonest, Today, 09:14 AM
              0 responses
              4 views
              0 likes
              Last Post FitSpressoHonest  
              Started by Davide999, 05-18-2023, 03:55 AM
              4 responses
              557 views
              1 like
              Last Post kcwasher  
              Started by rexsole, Today, 08:39 AM
              2 responses
              8 views
              0 likes
              Last Post NinjaTrader_Erick  
              Working...
              X