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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            152 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            305 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            244 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            345 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            176 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X