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 Brevo, Today, 01:45 AM
        0 responses
        3 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        239 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        6 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Working...
        X