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 love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    37 views
    0 likes
    Last Post love2code2trade  
    Started by alifarahani, Today, 09:40 AM
    2 responses
    13 views
    0 likes
    Last Post alifarahani  
    Started by junkone, Today, 11:37 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by pickmyonlineclass, Today, 12:23 PM
    0 responses
    3 views
    0 likes
    Last Post pickmyonlineclass  
    Started by frankthearm, Yesterday, 09:08 AM
    12 responses
    44 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X