Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change PeriodType

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

    Change PeriodType

    Is possible to change PeriodType with constant ?
    For example:
    If I loaded a chart at 1 minute timeframe i have in
    protected override void Initialize()
    {
    Add(PeriodType.Minute, 3);
    }

    but if I have a 5 mins chart i need to have :
    Add(PeriodType.Minute, 15);

    and if i have a 15 seconds charts i need to have:
    Add(PeriodType.Seconds, 45);

    The constant is 3 X loaded timeframe charts.

    How can I build a script to do this?

    Thanks in advance.

    #2
    Hello sniper,

    The following should work ok:

    protected override void Initialize()
    {
    Add(PeriodType.Minute, BarsPeriod.Value*3);
    }

    Let me know if this does not accomplish what you would like.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks. This is good for the minute, but if i load a bars charts in second or daily ?
      How can I change the command ?
      Thanks

      Comment


        #4
        The question is:
        How can I change BarsPeriod.Id in protected override void Initialize() ?

        Comment


          #5
          Hello sniper,

          It is not possible to change either BarsPeriod.Id or BarsPeriod.Value. But you can use this from the primary data series when adding a secondary data series.

          For example:
          Add(BarsPeriod.Id, BarsPeriod.Value*3);
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thanks, now it's perfect !

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 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
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X