Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Futures..Entry time & Exit on Close

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

    Futures..Entry time & Exit on Close

    Backtesting emini s&p, if I have a strategy based on a daily time frame with the entry condition based on the close price of the previous closed daily bar, why is it entering at 5:15pm ET as I thought the emini opened at 6pm ET?

    And then exit on close is set to true but it is not exiting on close which would be 4:15pm ET the next day as far as I understand. It just holds the trade open until the end date of the strategy?

    #2
    Hello Delta007,

    Welcome to the NinjaTrader Support Forums!

    NinjaTrader is going to use the Bar Time stamp for the entry time which is the end time of the bar. A Daily chart in a backtest is going to use the session template that is defaultly defined NinjaTrader which is going to be the "CME US Index Futures ETH" which is going to be from 5:00 PM to 4:15 PM which is what the execution is going to be.

    A Daily interval is not going to exit out the trade at the end of the day inside of a backtest. If you want to start a trade and end a trade in a single day you may want to use the Multi-Time Frame approach and use an Intraday chart but add a Daily Time Frame for you calculations.

    We have an example of this preloaded in Tools -> Edit NinjaScript -> Strategies -> SampleMultiTimeFrame strategy.

    You may also see our Help Guide at the following link for more information.



    Let us know if you have any further questions.
    JCNinjaTrader Customer Service

    Comment


      #3
      Follow up on this. Again Backtesting ES. If I have this simple condition below where I'm looking for it to enter a trade at the start of the next daily bar if the most recent daily close < previous daily close. I added a 1 min index to make sure it enters asap. Then I want it to exit at the Close of the daily bar it entered on. BIP is looking at 1min bars, Closes are based on daily and enter long on 1min bars. Is this the best way to set it up? It looks correct looking at the trades tab but I just want to double check...


      Code:
              protected override void Initialize()
              {             
                            //Primary is Daily 
      	              Add("ES ##-##",PeriodType.Minute, 1); //Index 1
                            CalculateOnBarClose = true;
              }
      
              protected override void OnBarUpdate()
              {
      			if ((BarsInProgress == 1) && Closes[0][0] < Closes[0][1])
      			EnterLong(1, 1, "EnterLong");
      
              }

      Comment


        #4
        Hello Delta007,

        That looks good.

        Let us know if you have any further questions.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X