Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading Hours

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

    Trading Hours

    Hi!

    I have a strategy that is supposed to trade between 9:30 AM EST and 3:59 PM EST.

    The strategy trades on 30 minute bars. I have CalculateOnBarClose set to false.

    Each time OnBarUpdate is called, I first check the time by the following statement:

    if (ToTime(Time[0]) > ToTime(9, 29, 59) && ToTime(Time[0]) < ToTime(15, 59, 0))

    All trade logic is followed only if the above statement is true.

    I have seen that when I first start the strategy around 9:15 am, it immediately places an order although the order does not get executed until after 9:30 am. Shouldn't the order be placed only after 9:30 am?

    I have also seen that during the last half hour of the day (between 3:30 pm EST and 4:00 pm EST), NO trades are placed even though according to the rules of the system, conditions are present for a trade to occur.

    Any ideas of what I need to change? I am on the East Coast and trade E-mini futures. The data feed is Interactive Brokers. Does it have anything to do with time zones?

    Thanks for your hlep.

    #2
    menlo,

    It depends what your strategy thinks. As you start up your strategy it calculates out a strategy position. This is a virtual position it thinks it should be in based on historical data. You need to check if this order signal was generated from those historical data and at what time.

    You will need to debug your strategy. Use print functions to first determine if your conditions are really true. Then use TraceOrders = true to track your orders.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh.

      When a statement such as the following is evaluated, what 'clock' is used? Is it my system time, the (IB) server time or the exchange (CME) time?

      if (ToTime(Time[0]) > ToTime(9, 29, 59) && ToTime(Time[0]) < ToTime(15, 59, 0))

      Rgds...

      Comment


        #4
        It is the timestamp of the bars. For you, that is in 30minute increments.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Josh.

          After using print statements and TraceOrders as you suggested, I have figured out the problem...

          I would like some help regarding the following:

          My strategy is running on 30 minute bars and at 3:59 pm EST, I would like to
          1) Cancel any open orders.
          2) Close all open positions.

          How would I achieve that? The timestamp of the last bar would be 4:00 pm and I would like to cancel and close everything out 1 minute before 4:00 pm.

          Thanks!

          Comment


            #6
            menlo,

            Can you not use the Exit on Close options available in the strategy dialogue window?
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            158 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Today, 09:29 PM
            0 responses
            7 views
            0 likes
            Last Post Belfortbucks  
            Started by zstheorist, Today, 07:52 PM
            0 responses
            7 views
            0 likes
            Last Post zstheorist  
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            151 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Started by mattbsea, Today, 05:44 PM
            0 responses
            6 views
            0 likes
            Last Post mattbsea  
            Working...
            X