Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Custom Bar Type - Break after the OPEN of the Day?

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

    Custom Bar Type - Break after the OPEN of the Day?

    Hi,
    We all know the nice functionality to use break at End of Day (EoD), which if activated, avoids bars spanning across day breaks.

    Any idea how I could create a custom bar type doing something similar after the start of the trading session?
    I'd like to align time based bars (e.g. hour) to the TURN OF THE FULL hour truncating the length of the FIRST bar, if the trading session doesn't start at the turn of the hour.

    EoD does this (bar type 1 Hour):
    Alt. 1: 09.30, 10.30, 11.30, 12.30, 13,30, 14.30, 15.30, 16.00 (truncated at end).
    Alt. 2: 09.00, ... 17.00, 17.30 (truncated at end, if end of trading session comes "early" compared to time, ticks, bricks).

    Custom bar type / Break after Open of Day functionality I have in mind should do this (bar type 1 Hour):
    09.30, 10.00 (truncate first bar), 11.00, 12.00, 13.00, 14.00, 15.00, 16.00

    Thank you.
    NT-Roland
    Last edited by NT-Roland; 11-28-2020, 05:37 AM.

    #2
    Hello NT-Roland,

    I want to clarify your goal. You want to mark the end of day from within BarsType script is this correct?

    This would typically be marked by the Trading Hours template. Are you wanting to write a template file and set the Trading Hours template from a BarsType script?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,
      Thanks for the question. No, that is not what I'm trying to accomplish. I want to align hourly or/and 30 min bars to the clock, if the trading session starts odd.
      If the trading session starts at e.g. 01.15, and I pick hourly bars, I want to create one "short" bar of 45 mins to align the "hourly" bar to the turn of the hour, followed by "regular" bars of 1 hour each until the end of the trading session.
      Same with 30 mins. If the start of the trading session is not a multiple of 30, align to such multiple on the first occasion, i.e. at 01.30 after 15 mins, then continue with "regular" 30 min bars until the end of the trading session.
      Hope this clarifies.
      NT-Roland

      Comment


        #4
        Hello NT-Roland,

        I think I'm getting a better understanding.

        So I do think this would be done in a custom bars type.

        You can check the time with some custom logic to decide when to make a bar, (such as the time.Minute being 30), and then call AddBar() instead of UpdateBar() to break a new bar early.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AveryFlynn, Today, 04:57 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Max238, Today, 01:28 AM
        4 responses
        37 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by r68cervera, Today, 05:29 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by geddyisodin, Today, 05:20 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by timko, Today, 06:45 AM
        2 responses
        14 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X