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

Strategy conditions at specific days in the month

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

    Strategy conditions at specific days in the month

    Hello guys,

    how do you create conditions for execute a strategy at specific days at the month?

    For example, I want an entry at the 8th day in the month and exit at the 3rd day in the month.

    Is it only possible via NinjaScript and what‘s the best way to do this?

    Thank you!



    #2
    Hello andi5385,

    You can compare a <DateTime>.Day to a specific number.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      thank you for your reply. How is it possible in the condition builder?

      Thank you!
      Andreas

      Comment


        #4
        Hi andi5385,
        To my understanding, this can not be done with the StrategyBuilder. At least, I'm not aware that my suggestion I posted here ever took flight.

        Somewhat strange that "Day of week" is available in Strategy Builder, but "Day of month", "Day of year" or "Month" are (still) not exposed?
        Unless this was fixed, you will have to use NinjaScript to detect a new month, if true, reset the TradingDay counter, increment by one on every other new day, compare the value of the counter with your entry (e.g. 8) and exit input (e.g. 3) and then place/terminate your trades accordingly. The counter itself could be built as follows in NinjaScript:
        if (Time[0].Date.Month != Time[1].Date.Month)
        {
        tradingDay = 1;
        }
        else
        {
        tradingDay++;
        }
        NT-Roland

        Comment


          #5
          Hello Andreas,

          Just confirm, NT-Roland is correct. The Day (of month) is not available in the Strategy Builder and this would require unlocking the script and coding by hand.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by FrazMann, Today, 11:21 AM
          0 responses
          1 view
          0 likes
          Last Post FrazMann  
          Started by geddyisodin, Yesterday, 05:20 AM
          8 responses
          51 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          10 responses
          36 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by DayTradingDEMON, Today, 09:28 AM
          4 responses
          24 views
          0 likes
          Last Post DayTradingDEMON  
          Started by George21, Today, 10:07 AM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X