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

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 Irukandji, Today, 04:58 AM
            0 responses
            2 views
            0 likes
            Last Post Irukandji  
            Started by fitspressoburnfat, Today, 04:25 AM
            0 responses
            2 views
            0 likes
            Last Post fitspressoburnfat  
            Started by Skifree, Today, 03:41 AM
            1 response
            4 views
            0 likes
            Last Post Skifree
            by Skifree
             
            Started by usazencort, Today, 01:16 AM
            0 responses
            1 view
            0 likes
            Last Post usazencort  
            Started by kaywai, 09-01-2023, 08:44 PM
            5 responses
            604 views
            0 likes
            Last Post NinjaTrader_Jason  
            Working...
            X