• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsPeriod.Id for Unirenko?

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

    BarsPeriod.Id for Unirenko?

    Hi Folks

    If I want code to identify whether the chart is a tick, minute or any standard NT bar type, I can use code such as:

    Code:
    if( BarsPeriod.Id == PeriodType.Tick )
    Now, there exist a few non-standard bar types such as Unirenko (available in this Forum for download, I think).

    BarsPeriod.Id == PeriodType.Unirenko doesn't work so I doubt this is possible but is there another way of identifying Unirenko in code in a similar way?

    Thanks in advance.

    #2
    Hello arbuthnot,

    You may need to use BarsPeriod.BasePeriodType and BarsPeriod.BasePeriodValue.

    Below is a link to the help guide on BarsPeriod.

    http://ninjatrader.com/support/helpG...barsperiod.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your help with this, Chelsea.

      I've thought of another approach. If I use only one non-standard bar type, i.e. Unirenko (after declaring a bool IfTime) I could code up something like this:

      Code:
      if (
      BarsPeriod.Id == PeriodType.Minute
      ||
      BarsPeriod.Id == PeriodType.Second
      )
      				
      IfTime = true;
      			
      else
      				
      IfTime = false;
      The 'else' here can only refer to the 'Unirenko' situation.

      My question now is: it probably doesn't make a great deal of difference, but would it be better to keep this code in OnBarUpdate or should it ideally be in something like OnStartUp?

      Thanks for letting me know.

      Comment


        #4
        Hello arbuthnot,

        If this were in on startup the condition wouldn't be checked on every bar. The performance to check this is minimal and you probably wouldn't notice a difference, but in the end it would have less code to run on every bar update.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks again, Chelsea, for your advice.

          Much obliged.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pstrusi, Today, 02:21 AM
          0 responses
          4 views
          0 likes
          Last Post pstrusi
          by pstrusi
           
          Started by indy73, Yesterday, 10:52 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_EricB  
          Started by priceisking, 05-13-2019, 08:30 AM
          6 responses
          37 views
          0 likes
          Last Post Harry
          by Harry
           
          Started by WgfhqDsdfg, Today, 12:56 AM
          0 responses
          6 views
          0 likes
          Last Post WgfhqDsdfg  
          Started by pjsmith, Today, 12:43 AM
          0 responses
          5 views
          0 likes
          Last Post pjsmith
          by pjsmith
           
          Working...
          X