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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    67 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    150 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    99 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X