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

Restrict Days in Bars Type

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

    Restrict Days in Bars Type

    Hello Ninjatrader staff,

    I have a bit of a peculiar question.

    I would like to restrict the days that a specific bars type (eg. Renko, Day, Minute) can process data to only the first Monday of the month. I know that this can be achieved on a weekly basis with a Trading Hours template, by only selecting Monday as a trading day, but the Trading Hours template restricts me to only intra-week periods, and does not allow me to use only the first Monday of the month.

    In a regular strategy script, I would use something like --> if (Time[0].Day <= 7 && Time[0].DayOfWeek == DayOfWeek.Monday) <-- which would give me the desired exclusion. But in the script of a Bars Type, the Time[0] function does not exist.

    So the question is, how can I code this in a Bars Type script?

    Thank you in advance for your time, I look forward to your answer.

    GLFX005

    #2
    Hello GLFX005,

    You could potentially use the timestamps from the data in a BarsType to check if the timestamp falls within a specific day and only build those bars, I have no idea how that would affect the end result chart though as I don't know of any bars type which omits data. You could try doing that to check if that works.

    The same type of condition you provided could be used, bars types don't use a time series and instead just have time object https://ninjatrader.com/support/help...ndatapoint.htm


    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by timmbbo, Today, 08:59 AM
    1 response
    2 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by KennyK, 05-29-2017, 02:02 AM
    2 responses
    1,280 views
    0 likes
    Last Post marcus2300  
    Started by fernandobr, Today, 09:11 AM
    0 responses
    2 views
    0 likes
    Last Post fernandobr  
    Started by itrader46, Today, 09:04 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by bmartz, 03-12-2024, 06:12 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Working...
    X