Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Non equidistant bars

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

    Non equidistant bars

    The FX market runs 24 hours a day, but there are some key times during that 24 hours. I would like to make a chart with bars that open and close at certain times of the day, that are not equal.... they range from 3 hours to 5 hrs....

    I wonder if this is possible to do at all...

    What if I set up a custom session template, with sessions that start and stop at the various times I want a bar to open and close? Each day would then have several sessions.... would NT break to a new bar at the biginning/end of a new session?
    What bar type would I select if it did?

    Is there another way to achieve this?

    #2
    Hello Crassius,

    Thank you for your post.

    This can be accomplished with creating custom Session Templates by going to Tools-->Session Manager-->New.

    I have provided a link below to our Help Guide that goes over the Session Manager.

    http://www.ninjatrader.com/support/helpGuides/nt7/using_the_session_manager.htm


    A new bar will be created at the beginning of each sessions start and close at the specified time.

    This works best with Minute based bars.
    CameronNinjaTrader Customer Service

    Comment


      #3
      Session Breaks

      Can you make Ninja NOT create a new bar at a session break. Trying to create my own bar type and do not want to have it automagically close the previous bar.

      Leroy

      Comment


        #4
        Hello Leroy,

        Thank you for your note.

        We are aware that a new bar is created on Session Break.


        In this case, create a custom Session Template that uses a week long session.
        Tools -> Session Manager




        Additionally, this will be resolved in the next major release of NinjaTrader.
        CameronNinjaTrader Customer Service

        Comment


          #5
          Work around?

          Is there a work around.

          Comment


            #6
            Leroy,

            The work around is creating a custom week long session that starts on Sunday or Monday and ends on Friday.
            CameronNinjaTrader Customer Service

            Comment


              #7
              Yes, this is the easy way....but there is a coding way to do it too, I'm sure.

              I'm working with a renko type bar, so I don't want it to close unless the threshold has been exceeded.

              pseudo code.......

              if (bars.IsNewSession(time))
              {
              if (high > renkohigh)
              {
              Data.Bar bar = (Bar) bars.Get(bars.Count-2);
              bars.RemoveLastBar();
              .. add bars using bar.Time up until the renko is just about to close and get
              close to the gap

              // final bar
              bars.AddBar(................., timenow....);

              }
              }

              Or something like that.

              Leroy

              (the week session thing works but is a pain in the buttocks for users).

              Comment


                #8
                Originally posted by ldissinger View Post
                Yes, this is the easy way....but there is a coding way to do it too, I'm sure.

                I'm working with a renko type bar, so I don't want it to close unless the threshold has been exceeded.

                pseudo code.......

                if (bars.IsNewSession(time))
                {
                if (high > renkohigh)
                {
                Data.Bar bar = (Bar) bars.Get(bars.Count-2);
                bars.RemoveLastBar();
                .. add bars using bar.Time up until the renko is just about to close and get
                close to the gap

                // final bar
                bars.AddBar(................., timenow....);

                }
                }

                Or something like that.

                Leroy

                (the week session thing works but is a pain in the buttocks for users).

                Unfortunately NinjaTrader does not support custom bar types...

                It is such badly needed functionality that there have been several hacks into this undocumented/unsupported area. It is possible.

                Try a search on "custom bar type", and that should get you started finding some code samples and discussions to learn from. But realize you are in an area that NT does not support.

                Please NinjaTrader... open up the custom bar type API and documentation.... we sorely need this functionality over and over again.

                Comment


                  #9
                  Crassius,

                  That is correct, unfortunately creating custom bar types is not supported.

                  Custom bar types are opened up with the @BarTypes.cs to show you how Bar Types are created so you can create your own.
                  CameronNinjaTrader Customer Service

                  Comment


                    #10
                    My code works great....but NT is jacking it up. That is the issue. There isn't too much to know about this area and the api would be so simple that they don't want to take the time to do it.

                    Weekly sessions fix the issue, but I know there is a workaround....they probably know what the workaround is, but don't want to tell us....just a guess...maybe they actually don't know.

                    Leroy

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by frslvr, 04-11-2024, 07:26 AM
                    9 responses
                    121 views
                    1 like
                    Last Post caryc123  
                    Started by rocketman7, Today, 09:41 AM
                    4 responses
                    15 views
                    0 likes
                    Last Post rocketman7  
                    Started by selu72, Today, 02:01 PM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_Zachary  
                    Started by WHICKED, Today, 02:02 PM
                    2 responses
                    15 views
                    0 likes
                    Last Post WHICKED
                    by WHICKED
                     
                    Started by f.saeidi, Today, 12:14 PM
                    8 responses
                    21 views
                    0 likes
                    Last Post f.saeidi  
                    Working...
                    X