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

CalculateOnBarClose is not updated in Initialize()

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

    CalculateOnBarClose is not updated in Initialize()

    I set CalculateOnBarClose to false in Initialize(), However, when I set a break point in OnBarUpdate() and check the value of CalculateOnBarClos, it is still true.Please see attached picture for detail.
    Attached Files

    #2
    Hello,

    Thanks for the note.

    The value that is set inside of the settings when you run the indicator/strategy and set it in the parameters this will override this settings.

    Also this is an indicator/strategy called from another strategy?

    A good role of thumb is to not set this value in Initialize, you will see that in all NinjaTrader indicators we never set this as it needs to always be set by the user as it can cause issues when you start chaining indicators together to run on each other and one is set to COBC = true and the other is set COBC = false.

    Let me know if I can be of further assistance.

    Comment


      #3
      Thanks for your reply, Brett.

      Actually, this is a strategy in single C# file. Besides, as shown by attached file, COBC is not set in public parameters. The place shown in #1 posting is the only place to set COBC in this strategy.
      Attached Files

      Comment


        #4
        Are you running a backtest here as this happens? Then COBC would always be true, as the intrabar formation is not known without any further finer time series added via code:

        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by
        Last edited by NinjaTrader_Bertrand; 06-06-2011, 01:44 AM.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          This is a backtest strategy to calculate some technical analysis values for securities. In theory, COBC should be set to true. However, if setting COBC to true with connecting Kinetick, it will only do calculation up to yesterday. To get calculation up to today, I have to set COBC to false. Do I misss something?

          Comment


            #6
            Hello,

            When you do the test are you testing it live or in backtest? In BackTest the value will always be true. Live however you can set it to false.

            Let me know if I can be of further assistance.

            Comment


              #7
              It's always in backtest. The interesting thing is it is running fine for a few months even I set COBC to false in Initialize(). Suddenly it did not work a couple of days ago. Now I have to set COBC to false in the very beginning of OnBarUpdate() to make it work.

              From perspective of coding, I think if I set COBC to false, then it should be false no matter where I set it, right?

              Comment


                #8
                Hello,

                Can you please the SampleMACrossOver strategy: Does it have the same symptom on your PC? If not we have narrowed it down to the strategy.

                You would need to send me code in this case. As not expected, I expect an external factor is causing this however would need more information to further assist.

                support at ninjatrader dot com

                I look forward to assisting you further.

                Comment


                  #9
                  Hi Brett,

                  After I simplified my code this weekend, I can not reproduce the issue. I will keep noticing this issue and let you know when I need help.

                  Thanks
                  Last edited by qfweiwei; 06-14-2011, 07:36 PM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by andrewtrades, Today, 04:57 PM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by chbruno, Today, 04:10 PM
                  0 responses
                  5 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
                  7 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