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 burtoninlondon, Today, 12:38 AM
    0 responses
    5 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X