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

Working with historical data

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

    Working with historical data

    Hi there,

    I have a strategy that looks at the daily chart for a signal and the 5min chart for entry and trades ES futures. I am struggling with historical data that falls outside of normal trading hours and holidays.
    I went into the Historical Data Manager and excluded days that included Sundays and Holidays. This removed those days from the daily chart, but the strategy still took trades on the excluded days as a 5 min bar was built. Do I have to exclude on the daily and delete the minute data to not take trades on these days in my strategy (just backtesting at this point)?
    The signal on the daily is an SMA so I want the SMA to reflect actual tradable days and not Sunday and holidays,. It seems right now that that is happening.
    IS there a way to exclude the days on the minute chart without having to delete the data other than programming a day of week exclusion or building an exclusion list?
    Thanks,

    stalt

    #2
    Stalt,

    I am happy to assist you.

    You can create a filter to make it so the strategy won't trade during times or during days you don't want it to trade.

    Here are some helpful links on how to do this.

    Using date time objects : http://www.ninjatrader.com/support/f...ad.php?t=19292

    Using a time filter : http://www.ninjatrader.com/support/f...ead.php?t=3226

    Please let me know if I can assist you further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      yes I do have some filters built into the strategy for specific days. The problem with Sunday and holiday data is that if it prints on the daily chart(where I am getting one signal) it can influence the value and/or reading of the indicator on the dialy and thus give unwanted entries on the 5min intraday. Plus one of the signals I use for entry is based on the close of the prior day at 4:15EST. Even if I exclude the daily data and exclude specific dates, is that it still seems to use the close of the holiday data as the reference for the currennt day. Only way I have found for it to reference the prior non holiday close is to delete both the daily and intraday data for holidays and sundays. if there is another option I am all ears.

      Comment


        #4
        Stalt,

        Are you using a custom SMA indicator or one that comes with the platform as default?

        You could put a time filter into the indicator to have it keep the same value as before when it is within some time bounds. You may have to adapt the SMA to be a custom indicator to do so, then add the time filter to it.

        As far as your other issue, you may have to make very specific filters for dates, or look at the time and date specifically to exclude holidays at certain times.

        I will look into this issue further and update you as soon as I can.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Apprecciate the reply. For now I have created a "fake" futures contract(one that will not get updated from a connected data feed) that I have removed the daily and minute data for all holidays and sundays. I only run my backtests on this data set. it has been a hassle, but to me it is the most foolproof way to handle this. My feeling is editing the data set once is probably easier than programming any future indicator or strategy I decide to run on this data set. If there is a more efficient manner to accomplish this I am very interested to hear. I am using the stock SMA indicator at the moment.

          I am thinking the dayofweek not sunday added to the indicator and then saved as custom indicator would work to remove sundays, but then I think I would have to further define the holidays and list each specific holiday case going back to the start of the data sets. thats about 7 dates a year. Can be done, but I think the issue woud be having the customize every indicator and every strategy one decided to run on this data.

          Is that correct?

          Comment


            #6
            Originally posted by stalt View Post
            yes I do have some filters built into the strategy for specific days. The problem with Sunday and holiday data is that if it prints on the daily chart(where I am getting one signal) it can influence the value and/or reading of the indicator on the dialy and thus give unwanted entries on the 5min intraday. Plus one of the signals I use for entry is based on the close of the prior day at 4:15EST. Even if I exclude the daily data and exclude specific dates, is that it still seems to use the close of the holiday data as the reference for the currennt day. Only way I have found for it to reference the prior non holiday close is to delete both the daily and intraday data for holidays and sundays. if there is another option I am all ears.
            You may want to look at this thread where a user has shared a boolean function that he created. You can use its output to exclude shortened days from being processed. As you can see from the code, it is easily extensible with new dates: just add them to the switch statement.

            ref: http://www.ninjatrader.com/support/f...914#post151914

            Comment


              #7
              Yes this is a great thread and that was what I was refering to as far as an exclusion list. The problem with this programming is would you not need to add that logic to each indicator used in a strategy and thus create all new customized indicators?
              Also one of my signals is based on the close of the prior day. WOuld I not have to add that logic to an indicator and referenec that indicator for both the daily and 5min timeframe?

              If I added the exclusion logic to the 5min time frame for example and monday was a holiday, would the strategy analyser know to reference Fridays close and not the holiday session close of monday for the signal?

              Comment


                #8
                Originally posted by stalt View Post
                Yes this is a great thread and that was what I was refering to as far as an exclusion list. The problem with this programming is would you not need to add that logic to each indicator used in a strategy and thus create all new customized indicators?
                Also one of my signals is based on the close of the prior day. WOuld I not have to add that logic to an indicator and referenec that indicator for both the daily and 5min timeframe?

                If I added the exclusion logic to the 5min time frame for example and monday was a holiday, would the strategy analyser know to reference Fridays close and not the holiday session close of monday for the signal?
                There are quite a few ways to handle this. You can put the function in a partial class like UserDefinedMethods, or create your own. That way, the function is available to all indicators/strategies. The downside is that anyone who uses any of the indicators is going to need to have the file that contains the function implementation.

                As far as exclusions based on other time filters, you would have to implement those filters. This function just gives you a means to filter out any shortened trading days/holidays.
                Last edited by koganam; 10-12-2011, 01:59 PM. Reason: Corrected grammar

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GussJ, 03-04-2020, 03:11 PM
                16 responses
                3,281 views
                0 likes
                Last Post Leafcutter  
                Started by WHICKED, Today, 12:45 PM
                2 responses
                19 views
                0 likes
                Last Post WHICKED
                by WHICKED
                 
                Started by Tim-c, Today, 02:10 PM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Taddypole, Today, 02:47 PM
                0 responses
                5 views
                0 likes
                Last Post Taddypole  
                Started by chbruno, 04-24-2024, 04:10 PM
                4 responses
                53 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Working...
                X