• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how can I know if a bar closes?

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

    how can I know if a bar closes?

    Hi,
    I have a strategy which I'm running tick-by-tick, meaning Calculate on Bar Close = False.

    However, I have some calculations I would like to perform only on bar close, so is there a way to tell if OnBarUpdate is called when the bar closes?

    Also, I would like to add another entry to my strategy, but I would like to avoid 2 entries on the same bar (and still keep Calculate on Bar Close = False). What is a good way of achieving that?

    Thanks.

    #2
    Hello gogetit,

    You can monitor for a new bar with FirstTickOfBar.

    This sample can help use this property to combine CalculateOnBarClose true / false logic in the same script:
    http://www.ninjatrader.com/support/f...ad.php?t=19387
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan!

      Comment


        #4
        You're welcome. For the question on preventing multiple entries on the same bar, you can use BarsSinceExit() for this.

        if (myEntryConditions && (BarsSinceExit() == -1 || BarsSinceExit() > 0))
        {
        //EnterHere
        }
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Did you mean BarsSinceEntry? I would like to add a second entry to the same trade, and just to make sure it's not on the same bar.
          Thanks.

          Comment


            #6
            Originally posted by gogetit View Post
            Did you mean BarsSinceEntry? I would like to add a second entry to the same trade, and just to make sure it's not on the same bar.
            Thanks.
            Gogetit,

            Yes in that case you would want to use BarsSinceEntry.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Lucas9435, Today, 08:12 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by mrtorture, Today, 08:11 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Heath  
            Started by Aporshnev, Today, 07:55 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by tonynt, Today, 08:12 AM
            0 responses
            2 views
            0 likes
            Last Post tonynt
            by tonynt
             
            Started by tff2011, Yesterday, 03:55 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X