Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Execute At Open

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

    Execute At Open

    Any plans for backtesting strategies based on the >open< of a candle?

    #2
    Hello siroki,

    Thanks for your post.

    Can you clarify what your questions relates to, IE Open as the input series? Calculate on bar open instead of on bar close?

    Thanks in advance.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I would like to test a strategy based on an entry at the open of a candle. So I guess CalculateOnBarOpen = true would be great.

      Comment


        #4
        Hello siroki,

        Thank you for your response.

        There a few items your inquiry could relate to. May we ask for further clarification?
        Please answer the following questions.

        Are you looking for the calculation of your logic to be performed only the Open as opposed to the Close?
        Are you looking to have the executions only occur on the Open of the bar and never after or on the Close?
        Are you looking for an intra-bar calculation much like running in real-time or Tick Replay?

        I look forward to your response.

        Comment


          #5
          Ideally I would like to be flexible in binding the entry/exit to open/close.. So for example: I would like to have a strategy where the exit is based on the Open of a candle and the Exit is based on the Close of a candle.

          But to have at least have an Entry based on the Open of a candle would be great. The whole problem is when testing stock strategies, the close of a candle does not mean you can enter the stock at the closing price. Especially in daily strategies where you can have gaps.

          Comment


            #6
            Hello siroki,

            Does this mean an order at the Open[0] price level? Or that it must execute on the open of the bar?

            Comment


              #7
              For backtesting, entering an order at Open[0] I guess will be fine? As long as I enter at the price of the Open[0].

              For live trading, I want to enter at the open of the bar.

              Comment


                #8
                So something like the following?
                Code:
                if(Close[0] > Open[0])
                EnterLongLimit(Open[0]);

                Comment


                  #9
                  But how does that work? Because once a candle close, you know the Close and the Open of that particular candle. If you EnterLongLimit(Open[0]), aren't you trying to enter the instrument at the Open price of the candle that just closed?

                  Furthermore, I want to measure certain indicators at moment the candle opens. And if the criteria are met, then enter immediately at the open.

                  Comment


                    #10
                    Hello,

                    You are correct, in a Backtest that would be the last closed candle, the code below would do what you are asking, but only in realtime and with CalculateOnBarClose set to false.

                    Originally posted by NinjaTrader_PatrickH View Post
                    So something like the following?
                    Code:
                    if(Close[0] > Open[0])
                    EnterLongLimit(Open[0]);
                    For BackTesting, you would essentially need to add a 1 tick series from the strategy and then on the 1st Tick after the Primary series bar closes, that would be the Open of the bar in which you could execute your logic.

                    NinjaTrader has no way of changing the Calculation to Open instead of Close of the bar so using a Tick series would be the only way to do this in a backtest.

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by trilliantrader, Today, 03:01 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post trilliantrader  
                    Started by pechtri, 06-22-2023, 02:31 AM
                    9 responses
                    122 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by frankthearm, 04-18-2024, 09:08 AM
                    16 responses
                    67 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by habeebft, Today, 01:18 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by benmarkal, Today, 12:52 PM
                    2 responses
                    19 views
                    0 likes
                    Last Post benmarkal  
                    Working...
                    X