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

Making that any Strategy ONLY trades during the Trading Hours in a specific template

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

    Making that any Strategy ONLY trades during the Trading Hours in a specific template

    Hello

    I’m in the Optimization process for one strategy and I was able to do the Optimization only takes trades until a specific exact time, for example, to close all the trades at 2:00 PM E.T. as late if any order is opened at that time. I did this by adding a custom template in the Trading Hours section.

    Then I go to a chart to load the data let’s say for the ES 12-21 using the same ‘Trading Hour’ template in the Data Series section > Time frame, but when I load the strategy to the chart I see the historical trades keep being placed until 5:00 PM E.T. why?

    I would like to know what would be the “universal” way to make any strategy works only until a specific time or even maybe during a custom specific range of hours every day.

    I understand there is a feature in the platform called ‘Auto close position’ but it doesn’t make a filter by strategy and it doesn’t give the option to set a start and end time, only an end time. And even using the ‘Auto close position’ feature I see the chart still loads the historical trades in the same way, with trades being placed until 5:00 PM E.T. and I don’t understand why the platform doesn’t handle the historical trades using this ‘Auto close position’ parameter.

    It would be perfect the Strategies section has something similar than Data Series > Time frame > Trading hours > loading the template you need in any situation or simply leaving the default instrument trading hours. Why this is not done in this way? Because it would be very very useful. Or why a strategy doesn’t work only in the Trading hours specified in the Data Series in the chart it is loaded? Also placing the historical trades in that way.

    Thank you

    #2
    Hello futurenow,

    Thank you for your post.

    The "universal way" to make a strategy only work between specific times would be to program that logic into the strategy directly - you can set up time filters as conditions within the strategy and even allow the user to select start and end times with a user input. I'm attaching a very simple example of a strategy that accepts a user input for start and stop times and will only trade between those hours.

    Please let us know if we may be of further assistance to you.

    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello futurenow,

      Thank you for your post.

      The "universal way" to make a strategy only work between specific times would be to program that logic into the strategy directly - you can set up time filters as conditions within the strategy and even allow the user to select start and end times with a user input. I'm attaching a very simple example of a strategy that accepts a user input for start and stop times and will only trade between those hours.

      Please let us know if we may be of further assistance to you.
      Thank you for your reply and the attached example

      I forgot to specify that this is not only for Stragies you are developing, it's mainly needed for strategies from 3rd-party developers where you don't have access to the logic and that for example maybe the developer is not currently giving support for the strategy etc. I'm referring to this type of situations.

      What would be the solution in those cases? Is there any way to externally specify to a strategy to only work during the time specified into a Trading Hours table? and in this way to solve the situation described in my first post above.

      Why the strategies are not just simply taking the trading hours reference from what is specified in the Data Series section?

      Thank you

      Comment


        #4
        Hello futurenow,

        Thank you for your reply.

        If the strategy is applied to a chart with specific trading hours set, I would not expect to see trades taken outside of that window, nor would I expect to see data on the chart outside of that window.

        Can you supply screenshots or steps to reproduce this behavior using the built in Sample MA Crossover?

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Bobin, Today, 06:39 AM
        0 responses
        7 views
        0 likes
        Last Post Bobin
        by Bobin
         
        Started by KirkHammett, Today, 03:23 AM
        0 responses
        5 views
        0 likes
        Last Post KirkHammett  
        Started by eleven, Yesterday, 10:06 PM
        0 responses
        39 views
        0 likes
        Last Post eleven
        by eleven
         
        Started by ezrollin, Yesterday, 08:12 PM
        7 responses
        72 views
        0 likes
        Last Post bltdavid  
        Started by kyamato, 11-23-2021, 10:51 PM
        6 responses
        91 views
        0 likes
        Last Post jeronymite  
        Working...
        X