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

OnBarUpdate Method && Time

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

    OnBarUpdate Method && Time

    Is it possible to create a method that is called at an exact time? I am writing an indicator that draws rectangles from 930 - 1600 on ES and 300 - 1100 on 6E on tick bar charts.

    I'm trying to write something that isn't dependent on Session Template dependent .

    I would like to find the barnumber and Open price right at 930 EST while using any bar type , specifically longer tick bars or 60 minute bar

    I could just use Calculate On Bar Close = False. But I would rather not run on every tick just to find the opening price and bar number.

    Any thoughts?
    Thank You!
    Westsider

    #2
    Hello,

    Thank you for your post.

    You may want to look into using OnMarketData() -
    http://www.ninjatrader.com/support/h...marketdata.htm

    This will allow you to check the incoming data and check the time of the tick and get that opening price.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by westsider View Post
      Is it possible to create a method that is called at an exact time? I am writing an indicator that draws rectangles from 930 - 1600 on ES and 300 - 1100 on 6E on tick bar charts.

      I'm trying to write something that isn't dependent on Session Template dependent .

      I would like to find the barnumber and Open price right at 930 EST while using any bar type , specifically longer tick bars or 60 minute bar

      I could just use Calculate On Bar Close = False. But I would rather not run on every tick just to find the opening price and bar number.

      Any thoughts?
      Thank You!
      Westsider
      And what is the exact time that you want to call the code?

      Comment


        #4
        Thanks Cal and Konagam,

        I want to make a call at 0300 and 0930,

        Checking out that method right now Cal

        Cheers
        Westsider

        Comment


          #5
          Originally posted by westsider View Post
          Thanks Cal and Konagam,

          I want to make a call at 0300 and 0930,

          Checking out that method right now Cal

          Cheers
          Westsider
          Code:
          if (ToTime(Time[0]) == 30000) //do stuff

          Comment


            #6
            Yes I use exactly that code -- that doesn't work if a bar close does not Begin at that time. I

            n the case of 60m bars or 4500 tick bars on the ES. that code will not render any values

            Comment


              #7
              Originally posted by westsider View Post
              Yes I use exactly that code -- that doesn't work if a bar close does not Begin at that time. I

              n the case of 60m bars or 4500 tick bars on the ES. that code will not render any values
              Which is why you should not be trying for an exact time, but a time that falls between or on bars.
              Code:
              if (ToTime(Time[1])<= 30000 && ToTime(Time[0]) >= 30000) //do stuff

              Comment


                #8
                koganam
                Thank You!!!! I have been messing around with this intermittently for D A Y S You Rock!

                I can't believe I didn't know this, it's elementary

                Westsider

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by andrewtrades, Today, 04:57 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                3 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                436 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                6 views
                0 likes
                Last Post FAQtrader  
                Started by rocketman7, Today, 09:41 AM
                5 responses
                19 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X