Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.Period.Value

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

    Bars.Period.Value

    I have looked through the contents and searched, but I cannot find information regarding the Bars values. I found methods under Bars such as GetBar. Where does the help discuss this??

    #2
    Hello rwbil,

    Are you referring to the BarsPeriod.Value?

    Below is a link to the help guide on BarsPeriod.
    http://www.ninjatrader.com/support/h...barsperiod.htm

    Let me know if this is not what you are looking for.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I will look. I guess that is it, but I was looking at the following code which compiles and runs.

      int margin = (Bars.Period.Value - (int)((High[0] - Low[0]) / TickSize));

      Does it know Bars.Period.Value is BarsPeriod.value?

      Comment


        #4
        Hello rwbil,

        Bars.Period.Value is not in the help guide and not supported to use. I am unsure of how this works. However, the supported way to find the bar type is to use BarsPeriod.Id and BarsPeriod.Value.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I see it also in the Unirenko bar type from your website shown below. Plus other bar. parameters


          public UniRenkoBarsType() : base(PeriodType.Custom5) { }

          static bool registered = Register(new UniRenkoBarsType());
          double barOpen;
          double barMax;
          double barMin;
          double fakeOpen=0;

          int barDirection=0;
          double openOffset=0;
          double trendOffset=0;
          double reversalOffset=0;

          bool maxExceeded=false;
          bool minExceeded=false;

          double tickSize=0.01;

          public override void Add(Bars bars, double open, double high, double low, double close, DateTime time, long volume, bool isRealtime)
          {
          //### First Bar
          if ((bars.Count == 0) || bars.IsNewSession(time, isRealtime))
          {
          tickSize = bars.Instrument.MasterInstrument.TickSize;

          trendOffset = bars.Period.Value * bars.Instrument.MasterInstrument.TickSize;
          reversalOffset = bars.Period.Value2 * bars.Instrument.MasterInstrument.TickSize;
          //bars.Period.BasePeriodValue = bars.Period.Value; //### Remove to customize OpenOffset

          Comment


            #6
            Hello rwbil,

            There are NinjaScripts in the forums that do use unsupported code.

            Officially, using a bar type that is not included with NinjaTrader is not supported by NinjaTrader.

            Is BarsPeriod.Value not working for you?
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            574 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            332 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
            553 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