Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-time frame: In which order are the Bars objects updated?

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

    Multi-time frame: In which order are the Bars objects updated?

    Hi guys,

    I have a very simple multi-time frame tryout strategy:

    The script checks the 1-minute and the 5-minute charts for "long" bars (close > open). If it finds the last 1-minute bar was a "long" bar AND the last 5-minute bar was a long bar as well, it buys the stock.

    The problem is: It works well except for the times when both the 1- and the 5-minute bars update.

    An example:

    2.40pm: The 5-minute bar closes at "long" (close > open).
    2.41pm: The 1-minute bar closes at "long" -> strategy buys stock -> ok.
    2.42pm: The 1-minute bar closes at "short" (close < open).
    2.43pm: The 1-minute bar closes at "long" -> strategy buys stock -> ok.
    2.44pm: The 1-minute bar closes at "short" (close < open).
    2.45pm: The new 5-minute bar closes at "short" (close < open). The 1-minute bar closes again at "long" again. Although the system shouldn't do anything now (since the newly-updated 1- and 5-minute bars do not both show "long"), it buys the stock. I assume it still thinks the 2.40pm 5-minute bar to be the current one.

    Is there a way I can tell the system to "wait" for the update of the 5-minute bar? Or can I somehow pause or delay the code execution to make sure the most recent 5-minute bar is being taken into account?

    Thanks,

    n.i.n.j.n.a.

    #2
    You need to add your bar series in the proper order. Largest to smallest. 5min should be your primary, 1min secondary.

    Then you will get this sequence:
    12:00PM 5min
    12:00PM 1min
    12:01PM 1min
    12:02PM 1min
    12:03PM 1min
    12:04PM 1min
    12:05PM 5min
    12:05PM 1min

    Evaluate your trades on the 1min. At 12:00, you have the most up-to-date 5min and 1min values. At 12:05, you also have the most up-to-date 5/1min values. Do not process on the 5min or else you will not have the most recent 1min values.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Works! Damn, you know your stuff......!

      One more thing: Since I'm now running/selecting the strategy on the 5-minute chart (with the 1-minute Bars objects added in the Initialize section), everything I plot is also plotted on the 5-minute chart.

      For example, I have the strategy plot little diamonds when it goes long. So I'm getting, for example, 3 little diamonds plotted in the same bar on the 5-minute chart when 3 of the underlying 1-minute bars match their criteria.

      Can I also have the system plot everything on the 1-minute chart instead?

      Thank you very much,

      n.i.n.j.n.a.

      Comment


        #4
        Unfortunately plotting is relative to the primary. Multi-series charting will be available in NT7.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          looking forward to NT7 then

          Thank you!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GussJ, 03-04-2020, 03:11 PM
          15 responses
          3,271 views
          0 likes
          Last Post xiinteractive  
          Started by Tim-c, Today, 02:10 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Taddypole, Today, 02:47 PM
          0 responses
          2 views
          0 likes
          Last Post Taddypole  
          Started by chbruno, 04-24-2024, 04:10 PM
          4 responses
          51 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          10 responses
          403 views
          1 like
          Last Post beobast
          by beobast
           
          Working...
          X