• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    JimNinjaTrader Customer Service

    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:
      https://www.screencast.com/t/ypZaf5i7cukS

      Comment


        #4
        Hello swooke.

        Thanks for the question.

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

        https://ninjatrader.com/support/help...properties.htm

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by PG7940, Today, 04:36 AM
        0 responses
        2 views
        0 likes
        Last Post PG7940
        by PG7940
         
        Started by elliot5, Today, 03:40 AM
        0 responses
        3 views
        0 likes
        Last Post elliot5
        by elliot5
         
        Started by itrader46, Today, 02:23 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by jeronymite, Today, 01:57 AM
        0 responses
        6 views
        0 likes
        Last Post jeronymite  
        Started by vonboettichert, Today, 01:24 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Marco  
        Working...
        X