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

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.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by inanazsocial, Today, 01:15 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by rocketman7, Today, 02:12 AM
    0 responses
    6 views
    0 likes
    Last Post rocketman7  
    Started by dustydbayer, Today, 01:59 AM
    0 responses
    1 view
    0 likes
    Last Post dustydbayer  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    5 responses
    23 views
    0 likes
    Last Post trilliantrader  
    Started by Davidtowleii, Today, 12:15 AM
    0 responses
    3 views
    0 likes
    Last Post Davidtowleii  
    Working...
    X