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

Exclude Holidays

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

    Exclude Holidays

    Ok I know there must be a better way to do this than the way I am doing it. Essentially I want to prevent my strategy from trading on pre-determined dates/holidays but I don't want to include this code in my strategy so I created an indicator which is called from the strategy. The values from the indicator are either 1 or 0 depending if it is a holiday or not. It works, but is there a better way for me to do this.Thoughts?
    Attached Files
    Last edited by cutzpr; 06-08-2016, 07:02 AM.

    #2
    Hello,
    Aside from including defining what days not to trade in the strategy this is the only other way I could think to do this.
    We will leave this thread open in case any other forum users have any thoughts on this.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by cutzpr View Post
      Ok I know there must be a better way to do this than the way I am doing it. Essentially I want to prevent my strategy from trading on pre-determined dates/holidays but I don't want to include this code in my strategy so I created an indicator which is called from the strategy. The values from the indicator are either 1 or 0 depending if it is a holiday or not. It works, but is there a better way for me to do this.Thoughts?
      It will have to be coded. Your method works, but there is a slightly less inelegant method detailed in this thread.

      ref: http://ninjatrader.com/support/forum...d.php?p=140164

      Look at the post by kdoren.

      Comment


        #4
        Originally posted by cutzpr View Post
        Ok I know there must be a better way to do this than the way I am doing it. Essentially I want to prevent my strategy from trading on pre-determined dates/holidays but I don't want to include this code in my strategy so I created an indicator which is called from the strategy. The values from the indicator are either 1 or 0 depending if it is a holiday or not. It works, but is there a better way for me to do this.Thoughts?
        You can also take a look at this library,

        Comment


          #5
          Originally posted by NinjaTrader_CodyB View Post
          Hello,
          Aside from including defining what days not to trade in the strategy this is the only other way I could think to do this.
          We will leave this thread open in case any other forum users have any thoughts on this.
          How would I go about adding it this to the define or creating a custom user define method. The directions on how to do it for NT7 do not pertain to NT8.

          Comment


            #6
            Hello,
            The UserDefined Methods are not in NinjaTrader 8.
            Please see the following post on this subject: http://ninjatrader.com/support/forum...15&postcount=2
            Cody B.NinjaTrader Customer Service

            Comment


              #7
              I never uploaded my solution, perhaps it can be useful for some one. I use two static Addons. Here is how I use them.

              PHP Code:
                      //Boolean for Holidays and NFP
                      
              private bool isHoliday;
                      private 
              bool isNFP
              PHP Code:
              if (Bars.IsFirstBarOfSession && IsFirstTickOfBar// Setup everything for the new session
                              
              {
                              
              isHoliday Holidays.IsItHoliday((ToDay(Time[0]) ) ); // Checks if the trading day is a holiday
                              
              isNFP NFPs.IsItNFP ((ToDay(Time[0]) ) ); // Checks if the current day is  NFP day 
                              









              Attached Files

              Comment


                #8
                Thanks so much!
                How would you access static addons from a strategy ?

                Comment


                  #9
                  I figured it out, I had to add:

                  using NinjaTrader.Custom.AddOns;

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by ScottWalsh, Today, 06:52 PM
                  4 responses
                  32 views
                  0 likes
                  Last Post ScottWalsh  
                  Started by olisav57, Today, 07:39 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post olisav57  
                  Started by trilliantrader, Today, 03:01 PM
                  2 responses
                  19 views
                  0 likes
                  Last Post helpwanted  
                  Started by cre8able, Today, 07:24 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post cre8able  
                  Started by Haiasi, Today, 06:53 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X