Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to know the periodtype of the chart you are executing a strategy?

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

    How to know the periodtype of the chart you are executing a strategy?

    I want to make some calculations within a strategy that let me automatically set different values depending on the period of the bar.

    For example, if I want the value of a SMA of the last day. It will be a SMA(24) in an hourly chart
    of a continuous traded instrument (like Forex), SMA(48) in 30' chart and so on.

    I want something like SMA(24h/period)

    Is it possible?

    Thanks in advance,

    Sergio

    #2
    Hi Sergio,

    Thanks for your post and question. You want to know the period that chart is in so that your strategy can adjust to the various timeframes. To accomplish this you can use BarsPeriod.BasePeriodType to obtain the period type chart (minute, hour, days, etc.) and the BarsPeriod.Value to obtain the integer value of the period.

    This information and more about BarsPeriod can be found in the help guide at this link: http://www.ninjatrader.com/support/h...barsperiod.htm

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    573 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X