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

Last Bar of Session

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

    Last Bar of Session

    Hello Ninja Team,

    I am looking for a way to check within a strategy if we are at the last Bar of the session.

    This should avoid the execution of an entry signal during the first bar of next days session (e.g. 7:00) which was created on the last bar of a session (19:00) - but not executed because of onBarClose.

    The session parameters(chart) are set to session from 7:00 to 19:00.

    I searched the forum for answers without success.
    Any Ideas ?

    TY

    #2
    I tried Bars.BarsSinceSession !=0 .

    This does not work, because the execution in the morning (e.g. 7:00) has Bars.BarsSinceSession = X , e.g. 31 from the previous session/ day.

    To make it really complicated: my executions are set to OnBarClose, market orders and I use range bars(Alt).


    The problem seems to be that the execution on BarClose of the last bar of session is in reality executed on the next day.

    If I use Range Bars instead of RangeAlt the problem is solved. But is there a way to have RangeAlt nonetheless ?
    Last edited by makra081; 03-09-2009, 06:21 AM.

    Comment


      #3
      Hi makra081, thanks for your posts - have you tried to limit your trading strategy with time filters? Please see this reference sample for details - http://www.ninjatrader-support2.com/...ead.php?t=3226
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Hello,

        TY for replying.

        Sadly that does not solve my problem.

        I set the Chart Session Parameter to 7:00-19:00.

        If there is a entry sig on the last bar - e.g 18:45 - the execution should be done on that day - not the next day !!

        Ninjatrader waits for the new Bar which is not printed before the next day.
        Last edited by makra081; 03-09-2009, 08:01 AM.

        Comment


          #5
          This is expected since I guess you run your strategy on CalculateOnBarClose = true, right?

          So this means the strategy waits for your 15 min bar to close to place orders on the next bar, which is then the first of the new day with your session times setup.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Yes I use CalculateOnBarClose = true. That is correct.

            Is there any way around this ?

            Comment


              #7
              You could try running your strategy on CalculateOnBarClose = false and then moving your trading signal logic to execute on the first tick of a new bar with if (FirstTickOfBar) ... http://www.ninjatrader-support.com/H...TickOfBar.html

              Of course you want to reference then one bar further back to adjust for this ([0] calls become [1]).
              BertrandNinjaTrader Customer Service

              Comment


                #8
                TY NinjaTrader_Bertrand

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Austiner87, Today, 03:42 PM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by cshox, Today, 11:11 AM
                2 responses
                15 views
                0 likes
                Last Post cshox
                by cshox
                 
                Started by algospoke, Today, 06:53 PM
                0 responses
                6 views
                0 likes
                Last Post algospoke  
                Started by mlprice12, 12-21-2021, 04:55 PM
                3 responses
                295 views
                0 likes
                Last Post paypachaysa  
                Started by lorem, 04-25-2024, 09:18 AM
                20 responses
                85 views
                0 likes
                Last Post lorem
                by lorem
                 
                Working...
                X