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

Minute timer on Range or Tick Period?

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

    Minute timer on Range or Tick Period?

    Is it possible to have a timer that triggers every new clock minute on an instrument that is set up for Range or Tick Periods

    #2
    Hi Turtle Trader,

    Sure, maybe try something like:

    DrawTextFixed("myText", (60 - DateTime.Now.Second).ToString(), TextPosition.BottomRight);
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      reply

      Would that be dependent on CalculateOnBarClose = False??

      In other words, the trigger of the timer would be dependent on the data feed in order to be triggered?

      If yes, then is there another way that is not dependent on the data feed?

      Comment


        #4
        reply

        I think what I need is a timer object...

        Comment


          #5
          Yes, timer object would be one aspect of it. And if you need to draw on chart at a different frequency than bar updates, will also have to override the Plot() method. We do not provide support for this but there is a sample available in all installations. Tools > Edit NinjaScript > Indicator > CustomPlotSample.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            start on minute boundary

            Hi Ryan,


            OK, the pieces are coming together...now the last part...


            I would like to start the timer exactly on a minute boundary, not on a bar event... so that it triggers exactly one minute later, and so on...


            (remember that these are tick or range bars...it would be easy if it were a 1 minute chart..)



            any suggestions?


            Thanks

            Comment


              #7
              My first reply offered this. Did you get a chance to apply it to a chart? It doesn't override plot so apply it to a liquid market and run with CalculateOnBarClose = false. DateTime.Now is your computer clock so not connected to bar updates.
              Last edited by NinjaTrader_RyanM1; 10-05-2011, 01:51 PM.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                reply

                OK, yes I tried that....however, it only updates when there is a tick....after hours and even during the day some slow moving instruments may not have a tick in a minute.

                I just tested this on CL (oil) around 7pm New York and it actually has dropped below a tick a minute at some times and the time didn't update when the clock turned over a minute.

                DrawTextFixed("myText", (DateTime.Now.Minute).ToString(), TextPosition.BottomRight);

                It might be OK to use it like this..." close enough", but I was hoping to set up the timer exactly on a minute boundary then just let it fire.

                Comment


                  #9
                  It's not the value DateTime.Now.Second that needs to be changed here. It's that all the plotting and drawing logic is tied to OnBarUpdate. If you need to draw on chart at a different frequency than bar updates, you have to override plot method.
                  Last edited by NinjaTrader_RyanM1; 10-06-2011, 10:48 AM.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by wzgy0920, 04-20-2024, 06:09 PM
                  2 responses
                  26 views
                  0 likes
                  Last Post wzgy0920  
                  Started by wzgy0920, 02-22-2024, 01:11 AM
                  5 responses
                  32 views
                  0 likes
                  Last Post wzgy0920  
                  Started by wzgy0920, Yesterday, 09:53 PM
                  2 responses
                  49 views
                  0 likes
                  Last Post wzgy0920  
                  Started by Kensonprib, 04-28-2021, 10:11 AM
                  5 responses
                  191 views
                  0 likes
                  Last Post Hasadafa  
                  Started by GussJ, 03-04-2020, 03:11 PM
                  11 responses
                  3,231 views
                  0 likes
                  Last Post xiinteractive  
                  Working...
                  X