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

Advanced help with bar type needed

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

    Advanced help with bar type needed

    I have written a Three Line Break bar type, and I'm having trouble resolving an error in this part of the code...

    public TLBBarsType() : base(PeriodType.TLB)
    {
    }

    It is consistent with NT's code...

    public RangeBarsType() : base(PeriodType.Range)
    {
    }
    public TickBarsType() : base(PeriodType.Tick)
    {
    }

    I know NT 7 includes Three Line Break bar type, but I need this bar type now. Unless NT 7 will be available in a couple of weeks.

    Thanks for anyone's help.
    Attached Files

    #2
    zacharydw00, unfortunately this is outside of the scope we support - you could check into the other addons bars types posted to the sharing to compare and debug. Correct, NT7 will have a TLB chart per default then.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by zacharydw00 View Post
      I have written a Three Line Break bar type, and I'm having trouble resolving an error in this part of the code...

      public TLBBarsType() : base(PeriodType.TLB)
      {
      }

      It is consistent with NT's code...

      public RangeBarsType() : base(PeriodType.Range)
      {
      }
      public TickBarsType() : base(PeriodType.Tick)
      {
      }

      I know NT 7 includes Three Line Break bar type, but I need this bar type now. Unless NT 7 will be available in a couple of weeks.

      Thanks for anyone's help.

      zacharydw00,

      Try this,

      public TLBBarsType() : base(PeriodType.Custom3)

      RJay
      RJay
      NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

      Comment


        #4
        THANKS rt6176 that fixed it, but in "Format Data Series" dialog box shows 'Custom3' as the bar type name. Any ideas on how to show the name 'TLB' instead? Much obliged.

        Comment


          #5
          Originally posted by zacharydw00 View Post
          THANKS rt6176 that fixed it, but in "Format Data Series" dialog box shows 'Custom3' as the bar type name. Any ideas on how to show the name 'TLB' instead? Much obliged.

          This label's Chart display

          public override string DisplayName
          {
          // get { return PeriodType.ToString(); }
          get { return "TLB"; }
          }

          Display in data format series


          public override string ToString(Period period)
          {
          return "TLB " + period.Value.ToString() + " Ticks";
          }
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment


            #6
            AddBat() vs. UpdateBar()

            Can someone explain what the difference is between AddBar() vs. UpdateBar()?? And, why UpdateBar() is necessary?
            NT maxes out the CPU cycles when I don't use UpdateBar() in my bar type code, and fails to build a chart(a 1 day chart).

            Here is an example of code from EdsRenko bars that confuses me...

            if (close == lastBrickHigh + rangeValue)
            {
            UpdateBar(bars, lastBrickHigh, close, low, close, time, volume);
            lastBrickLow = lastBrickHigh;
            lastBrickHigh = close;
            AddBar(bars, close, close, close, close, time, volume);
            }

            Why would close be used in all 4 prices of AddBar()?

            Thanks a bunch.

            PS - Thanks rt. get { return "TLB"; } is what I needed.
            Last edited by zacharydw00; 01-26-2010, 02:41 PM.

            Comment


              #7
              Originally posted by zacharydw00 View Post
              Can someone explain what the difference is between AddBar() vs. UpdateBar()?? And, why UpdateBar() is necessary?
              NT maxes out the CPU cycles when I don't use UpdateBar() in my bar type code, and fails to build a chart(a 1 day chart).

              Here is an example of code from EdsRenko bars that confuses me...

              if (close == lastBrickHigh + rangeValue)
              {
              UpdateBar(bars, lastBrickHigh, close, low, close, time, volume);
              lastBrickLow = lastBrickHigh;
              lastBrickHigh = close;
              AddBar(bars, close, close, close, close, time, volume);
              }

              Why would close be used in all 4 prices of AddBar()?

              Thanks a bunch.

              PS - Thanks rt. get { return "TLB"; } is what I needed.

              zacharydw00,

              If I read your code correctly, when the "if" condition is met, UpdateBar is used to force the current bar to certain values.

              Then AddBar closes that bar with the Updated values and begins a new bar with the specified AddBar values.

              If the market gaped past the values of lastbrickHigh or lastBrickLow, The UpDateBar command can, remove from the bar or add to the bar, to the correct bar close value and then an AddBar takes place at those values.

              The next chart update brings the new bar up to "live" values.

              Stare at it a while. It will make sense eventually. It took me weeks and months to figure out how chart programs worked.

              RJay
              Last edited by RJay; 01-26-2010, 03:48 PM.
              RJay
              NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

              Comment


                #8
                Hi Zac,

                RT explained it well. Basically adding a live bar always start at one price point, so OHLC should all be at the same price. UpdateBar then changes that live bar until another AddBar ends its life.

                Comment


                  #9
                  "Then AddBar closes that bar with the Updated values and begins a new bar with the specified AddBar values. "

                  This just made my day after breaking my head for 24 hours with what is going on under the hood of these methods. Thank you
                  Last edited by tradealgo; 08-29-2018, 09:16 AM. Reason: mistake in spelling

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by algospoke, Today, 06:40 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post algospoke  
                  Started by maybeimnotrader, Today, 05:46 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post maybeimnotrader  
                  Started by quantismo, Today, 05:13 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post quantismo  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  8 responses
                  168 views
                  0 likes
                  Last Post jeronymite  
                  Started by cre8able, Today, 04:22 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X