Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose = false

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

    CalculateOnBarClose = false

    I have set CalculateOnBarClose = false within the strategy code
    yet when I run the strategy the entry signals are not being generated until the start of the next bar.
    Is there anything else which could be impacting this?

    #2
    fiddy, and when you check the UI parameters of the running strategy, it's still set to false correct?

    Do you have any logic in FirstTickOfBar?

    What indicator do you call in your script? Any custom ones that might have the COBC setting explicitly set in their own Initialize() as well?

    Comment


      #3
      In the UI I cannot see a CalculateonBarClose Option
      Below is the code I have so far, which is waiting to the next bar
      Should I be using something other than CLOSE[0]

      protectedoverridevoid Initialize()
      {
      ExitOnClose =
      true;
      CalculateOnBarClose =
      false;
      DefaultQuantity =
      100;
      }
      ///<summary>
      /// Called on each bar update event (incoming tick)
      ///</summary>
      protectedoverridevoid OnBarUpdate()
      {
      if (Bars.FirstBarOfSession)
      {
      LowSupport = PriorDayOHLC().PriorLow[
      0];
      HighResistance = PriorDayOHLC().PriorHigh[
      0];
      }

      // Condition set 1
      if (CurrentDayOHL().CurrentOpen[0] < LowSupport
      && Close[
      0] > LowSupport)
      {
      EnterLong(DefaultQuantity,
      "");

      Comment


        #4
        fiddy, if you don't see the UI option for CalculateOnBarClose - are you in the backtesting engine then as this is seen? Here there would be no option to work on any other CalculateOnBarClose then true, as per default the intrabar formation of the bars would not be known.

        Comment


          #5
          Hi Bertrand,

          Apologies I do not follow what you have explained.
          I am in the strategy analyser and in the toolbar that appears on right, there is no CalculateOnBarClose field.

          Comment


            #6
            Correct, in backtesting there would be no option to set CalculateOnBarClose to false, thus it would be true all the times as historical data is processed. Even if you set this in your code, the processing for that part of the data is still CalculateOnBarClose == true.

            Comment


              #7
              Thanks for the reply. Is there anything I can do then in back testing to enable me to test when setting is false.

              Comment


                #8
                You could look into simulating those conditions on a lower timeframe series thus to be able to look inside that bigger timeframe bar. For order submission and fills, you can send them as well to a finer series - we have a reference sample to demonstrate this technique - http://www.ninjatrader.com/support/f...ead.php?t=6652

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Hwop38, 05-04-2026, 07:02 PM
                0 responses
                182 views
                0 likes
                Last Post Hwop38
                by Hwop38
                 
                Started by CaptainJack, 04-24-2026, 11:07 PM
                0 responses
                334 views
                0 likes
                Last Post CaptainJack  
                Started by Mindset, 04-21-2026, 06:46 AM
                0 responses
                258 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by M4ndoo, 04-20-2026, 05:21 PM
                0 responses
                358 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Started by M4ndoo, 04-19-2026, 05:54 PM
                0 responses
                187 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Working...
                X