Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose?

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

    CalculateOnBarClose?

    I understand when using automated strategies with CalculateOnBarClose set to True that your orders are placed at the close of the bar, but when set to False where do the orders get filled?

    #2
    Originally posted by kinkeadfx View Post
    I understand when using automated strategies with CalculateOnBarClose set to True that your orders are placed at the close of the bar, but when set to False where do the orders get filled?
    On any tick where the condition happens.

    EntriesPerDirection can limit that to only 1 order, so you don't send thousands of orders.

    Comment


      #3
      How can i modify the ninjascript code to place the entry orders at the open of the bar?

      Comment


        #4
        kinkeadfx, what orders types are you working with here? You are correct in understanding that with CalculateOnBarClose = true the OnBarUpdate() is only called when the bars are closed, that happens in NT when the open tick of the next bar was seen and this would be the first point you could trade at - so the open and closing tick are essentially the same.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by kinkeadfx View Post
          How can i modify the ninjascript code to place the entry orders at the open of the bar?
          You mean the Open of the current processing bar, with CalculateOnBarClose false?

          Comment


            #6
            When backtesting on Ninjatrader how does it calculate its results? I usually see where trades were placed at the open of the bar, can this be a result of CalculateOnBarClose set to False?

            Comment


              #7
              Originally posted by kinkeadfx View Post
              When backtesting on Ninjatrader how does it calculate its results? I usually see where trades were placed at the open of the bar, can this be a result of CalculateOnBarClose set to False?
              CalculateOnBarClose is not really relevant in any context where there is no (quasi or true) live streaming data. The program can only process data that it has available, and the only available data during a Backtest is the OHLC data, so updates can only be run on the bar once. In effect with Backtesting, CalculateOnBarClose is always processed as if it were true.

              Comment


                #8
                Ok so when using CalculateOnBarClose set to False on automated strategies, do the indicators used in the strategy need to be set to False as well so that everything works right?

                Comment


                  #9
                  Originally posted by kinkeadfx View Post
                  Ok so when using CalculateOnBarClose set to False on automated strategies, do the indicators used in the strategy need to be set to False as well so that everything works right?
                  Changing it not specifically needed, however you generally want to ensure you don't set any COBC hardcoded in any of your strategy called scripts.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by kinkeadfx View Post
                    Ok so when using CalculateOnBarClose set to False on automated strategies, do the indicators used in the strategy need to be set to False as well so that everything works right?
                    There seems to be a consensus that if you do not use a CalculateOnBarClose directive in the indicator, when it, the indicator is called from a strategy, the indicator adopts the COBC setting from the strategy.

                    However, even if you do use a COBC directive in the indicator, you can always set COBC false for the indicator every time that you call the indicator from the strategy. After all, it is just a property of the indicator object. In that case, it is best to use a named instance. Heck, it is always best to use a named instance.

                    Comment


                      #11
                      How could i get my entry order to open on the first tick of the next bar after the strategy gives a signal?

                      Comment


                        #12
                        Originally posted by kinkeadfx View Post
                        How could i get my entry order to open on the first tick of the next bar after the strategy gives a signal?
                        Are you talking real time, or in backtest?

                        Real time, that is the behavior if CalculateOnBarClose is true. In backtest, depending on how your signal is validated, it might work that way, or you might need to use a multi-timeframe script that uses a finer granularity barSeries, (1-tick or 1-range), to place orders that are triggered on the higher timeframe barSeries.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Perr0Grande, Today, 08:16 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post Perr0Grande  
                        Started by elderan, Today, 08:03 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post elderan
                        by elderan
                         
                        Started by algospoke, Today, 06:40 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post algospoke  
                        Started by maybeimnotrader, Today, 05:46 PM
                        0 responses
                        12 views
                        0 likes
                        Last Post maybeimnotrader  
                        Started by quantismo, Today, 05:13 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post quantismo  
                        Working...
                        X