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

Custom bar type and its parameter passing

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

    Custom bar type and its parameter passing

    I have a custom bar type that requires 3 parameters, which I'd like to pass through, programmitically.

    1. Can I pass in a very large Bars period value, which will then be parsed inside the custom bar class? Eg, pass in "234567" which will then be separated as "23", "45", "67". I seem to have problem setting a very large period number via Add(...., xx).

    2. Can I set the Period.Value2 via BarsPeriods[x].Value2 in OnStartUp()?


    Thanks in advance.

    #2
    Hello ckkoh_sgp,

    1. Yes, you can do this with custom programming. Note that Custom Bar Types are not something that we can support in NinjaTrader.

    2. While, yes it is possible to set the variable inside of OnStartUp() this is something that we would not recommend as you would have to Reload All Historical Data inside of the Chart by right clicking to be able to change the period value to what you would like.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi JC,

      Regarding (1), I've tried passing a large value eg. Add( PeriodType.Custom5, 102030) in my indicator but I do not get any data in the corresponding BarsInProgress in OnBarUpdate(). However, if I set a smaller number like 300, I can get data coming through the corresponding BarsInProgress. Wonder if there is a check being done in the Ninjatrader Bars class that restrict very large number being set?

      2) I've tried setting Period.Value2 via BarsPeriods[x].Value2 in OnStartUp() which takes place when the chart loads the indicator. However, the value do not seem to really changed, the Bars seem to still take whatever the internal Period.Value2?

      3) Is it possible to initialize the Period.Value2 and Period.BasePeriodValue to a pre-determined value in a custom Bar type? If yes, how to do so?


      Thanks in advance.

      Comment


        #4
        Hello ckkoh_sgp,

        Thank you for your response.

        1. There is no restriction on the size of the period used in NinjaTrader. You may not see any data as your custom bar type needs to be debugged for larger periods.

        2. You will not be able to reset the secondary BarsPeriod, it is a value that has been preset when using Add() or when you select the primary bar series for your chart or strategy on the Strategies tab.

        3. Under the public class DayBarsType : BarsType you will see a method called ApplyDefaults(), this may be what you are looking for regarding your custom bar type.

        Please let me know if I may be of further assistance.

        Comment


          #5
          Hi Patrick,

          Thanks.

          Can you explain the purpose of the code " if(bars.Count < tmpCount && bars.Count > 0 )" in Add() function of RenkoBarsType() in BarsTypes.cs file? What does it mean by the comment "reset cache when bars are trimmed" ?

          Comment


            #6
            Hello ckkoh_sgp,

            Thank you for your response.

            This is used to re-draw the Renko Bars for price movement. For information on the Bar Types please visit the following link: http://www.ninjatrader.com/support/h.../bar_types.htm

            Please let me know if I may be of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bmartz, 03-12-2024, 06:12 AM
            4 responses
            31 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by Aviram Y, Today, 05:29 AM
            4 responses
            11 views
            0 likes
            Last Post Aviram Y  
            Started by algospoke, 04-17-2024, 06:40 PM
            3 responses
            28 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by gentlebenthebear, Today, 01:30 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by cls71, Today, 04:45 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X