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 = 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?
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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.
            BertrandNinjaTrader Customer Service

            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
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by gentlebenthebear, Today, 01:30 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by Aviram Y, Today, 05:29 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by cls71, Today, 04:45 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by TradeForge, Today, 02:09 AM
                1 response
                22 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by elirion, Today, 01:36 AM
                2 responses
                14 views
                0 likes
                Last Post elirion
                by elirion
                 
                Working...
                X