Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with a mental block

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

    Help with a mental block

    Can someone help me with the following code so that it will return the same Open price as I switch chart settings from 1min to 5min to 15min to 30min (time segments divisible into the 9:30 EST open time). I looked at it on a 24hr ES chart EST.

    I know there is something about a bar being finished only on the incoming tick of a new bar, but when I look at it on a 30min chart, the closest opening price to a 1min chart actually looks to be 2 bars back, not 1. With the crosshairs ON, you can see that the plot starts at the 9:30 bar.

    If someone could point out the code error in the zip I would appreciate it.
    Attached Files

    #2
    Originally posted by Tarkus11 View Post
    Can someone help me with the following code so that it will return the same Open price as I switch chart settings from 1min to 5min to 15min to 30min (time segments divisible into the 9:30 EST open time). I looked at it on a 24hr ES chart EST.

    I know there is something about a bar being finished only on the incoming tick of a new bar, but when I look at it on a 30min chart, the closest opening price to a 1min chart actually looks to be 2 bars back, not 1. With the crosshairs ON, you can see that the plot starts at the 9:30 bar.

    If someone could point out the code error in the zip I would appreciate it.
    Hi Tarkus,

    I'm not an expert with this, so you'll have to wait for someone else for that, but perhaps in the meantime you can try it with CurrentDayOHL? ( http://www.ninjatrader-support.com/H...?CurrentDayOHL )

    For example; CurrentDayOHL().CurrentOpen[int barsAgo]
    i.e.
    if(ToTime(Time[0]) >= startTime && ToTime(Time[0]) <= endTime)
    {
    Plot0.Set(CurrentDayOHL().CurrentOpen[0]);
    }

    Good Luck!

    Regards,

    Comment


      #3
      Originally posted by J_o_s View Post
      Hi Tarkus,

      I'm not an expert with this, so you'll have to wait for someone else for that, but perhaps in the meantime you can try it with CurrentDayOHL? ( http://www.ninjatrader-support.com/H...?CurrentDayOHL )

      For example; CurrentDayOHL().CurrentOpen[int barsAgo]
      i.e.
      if(ToTime(Time[0]) >= startTime && ToTime(Time[0]) <= endTime)
      {
      Plot0.Set(CurrentDayOHL().CurrentOpen[0]);
      }

      Good Luck!

      Regards,

      Thank you for the assistance!

      Comment


        #4
        Tarkus, to know why that discrepancy occurred you need to know that in NT the bar time refers to the closing time of the bar. Therefore all those different bars would have the same Close price but the Open would be drastically different. The Open of a 9:30 30 minute bar would occur at 9:00. The Open of the same bar on a 5 min. chart would occur at 9:25 and on a 1 min. chart would occur at 9:29. Obviously the prices at these different times will be different.

        Dan
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #5
          Originally posted by eDanny View Post
          Tarkus, to know why that discrepancy occurred you need to know that in NT the bar time refers to the closing time of the bar. Therefore all those different bars would have the same Close price but the Open would be drastically different. The Open of a 9:30 30 minute bar would occur at 9:00. The Open of the same bar on a 5 min. chart would occur at 9:25 and on a 1 min. chart would occur at 9:29. Obviously the prices at these different times will be different.

          Dan
          Thanks for the explanation. It makes it much clearer.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          601 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          347 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          559 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          558 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X