Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading Day of Month, Week, etc.

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

    Trading Day of Month, Week, etc.

    Hello,

    With NT7, am I able to set up an automated trading strategy for certain futures markets and backtest/automatically trade the strategy?

    For example, let's take the E-Mini S&P 500. I would like to create a strategy and/or backtest.... "Long IF trading day of the month = 3 AND trading day of the week does not = Monday."

    In this example, I would be buying on the open IF the trading day of the month is 3 and the trading day of the week is not Monday.

    Also, I would like to just backtest buying on the open of each single day of the month and exiting on the next profitable open, with a certain dollar stop loss.

    Any videos/tutorials or guidance you could give me would be greatly appreciated! Thanks so much!

    #2
    Hello JGCapitalia,

    Yes, it possible to create conditions that compare the DateTime of the bar.

    Below is a link to a video.
    https://www.youtube.com/watch?v=HCyt...u.be&t=43m 30s

    And the reference sample in the help guide.
    https://ninjatrader.com/support/help...to_limit_t.htm

    A link to the help guide on Time[0].
    https://ninjatrader.com/support/help...eries_time.htm

    As well a link to the Microsoft Documentation on DateTime.
    https://docs.microsoft.com/en-us/dot...ew=netcore-3.1
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you, Chelsea! Am I able to backtest the strategy with NT7's data using Kinetick EOD Free?

      Comment


        #4
        Hello JGCapitalia,

        Your post is in the NinjaTrader 8 strategy development section of the forums.

        Is your inquiry for NinjaTrader 7, or are you asking how to do this in NinjaTrader 7 as well?

        Kinetick EOD provides end of day data (daily bars) which can be used for backtesting over Day, Week, Year bar types.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea, oops, my bad. My inquiry was for NT7. I didn’t know there were two separate forums. Does it work the same way for NT7?

          Comment


            #6
            Hello JGCapitalia,

            I've moved your thread to the NinjaTrader 7 Strategy Development section of the forums.
            https://ninjatrader.com/support/foru.../ninjatrader-7

            Below are these links for NinjaTrader 7.
            https://www.youtube.com/watch?v=FmBi...tu.be&t=28m20s
            https://ninjatrader.com/support/help...to_limit_t.htm
            https://ninjatrader.com/support/helpGuides/nt7/time.htm

            Yes, this would be the same for NinjaTrader 7.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello,

              Can anyone help me create the strategy I posted above. I viewed all the videos but it seems to only show a specific date and a specific time. I only need the Trading Day of the Month such as 1, 2, 3, etc. as there are only 21-22 actual trading days per month. The "time series" gives the entire date, which it seems that it would not backtest trading days in the past. Thanks so much!

              I'm looking to create a strategy and backtest the e-mini S&P 500 to:

              1. Buy one contract of the S&P 500 Emini on the Open IF the trading day of the month = 1
              2. Dollar Stop Loss of $1,500 when the long position is triggered.
              2. Exit on the first profitable open

              Comment


                #8
                Hello JGCapitalia,

                Thank you for your post.

                Please see the attached example strategy that demonstrates how this could be accomplished. In the example strategy, we check to see if the month is the current month followed by assigning a variable the value Time[0].Day. We then check if our variable == Time[0].Day to get the first trading day of the month. In our firstDayOfMonth check, we call EnterLongLimit() to place an entry order at the Open of the current bar. It also calls ExitLongStopLimit to place a $1500 stop loss from the average entry price. The script then checks if we are in a long position using Position.MarketPosition == MarketPosition.Long and we check if Position.GetProfitLoss is greater than 0 for the current Open and call ExitLong to exit our position at the first profitable open.

                See the help guide documentation below for more information.

                Time[] - https://ninjatrader.com/support/helpGuides/nt7/time.htm
                MarketPosition - https://ninjatrader.com/support/help...etposition.htm
                GetProfitLoss - https://ninjatrader.com/support/help...profitloss.htm
                EnterLongLimit - https://ninjatrader.com/support/help...rlonglimit.htm
                ExitLongStopLimit - https://ninjatrader.com/support/help...gstoplimit.htm
                ExitLong - https://ninjatrader.com/support/help...7/exitlong.htm

                Please let us know if we may assist further.
                Attached Files
                Brandon H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by jc.am, Today, 07:59 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_EricB  
                Started by ybhx0315, Today, 09:06 PM
                0 responses
                6 views
                0 likes
                Last Post ybhx0315  
                Started by parkinsonbr, Today, 08:23 PM
                0 responses
                3 views
                0 likes
                Last Post parkinsonbr  
                Started by i2w8am9ii2, Today, 04:36 PM
                2 responses
                13 views
                0 likes
                Last Post i2w8am9ii2  
                Started by WeyldFalcon, Today, 02:07 PM
                2 responses
                16 views
                0 likes
                Last Post WeyldFalcon  
                Working...
                X