Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar Start time

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

    Bar Start time

    I see that I can use Time[0] to get the current bar end time. Is there a direct way to get the bar start time as well from inside OnBarUpdate?

    #2
    Hello swooke,

    Thanks for your post.

    You could use Calculate.OnEachTick and then check DateTime.Now on IsFirstTickOfBar which will tell you the time of the tick that opened the bar.

    This would only work for realtime data and would not be relevant for backtesting. If you want a backtestable solution, I recommend adding a single tick data series and checking the timestamp of the tick that occurs just after the bar closure for the primary bar is seen.

    IsFirstTickOfBar - https://ninjatrader.com/support/help...ttickofbar.htm

    Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm

    Please let me know if there is anything else we can do to help.

    Comment


      #3
      Thanks Jim,

      Just one other quick question. How can I get the distance between each candle body? For example, in the screencast link below, I pointed to the gap with a red arrow. I tried BarMarginLeft but that always returns 8 pixels. Here is the screenshot:
      World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.

      Comment


        #4
        Hello swooke.

        Thanks for the question.

        I believe you are looking for ChartControl.Properties.BarDistance.



        Please let me know if there is anything else we can do to help.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X