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 funk10101, Today, 09:43 PM
        0 responses
        6 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        37 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        26 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Working...
        X