Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Logic for close position strategy builder

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

    Custom Logic for close position strategy builder

    Our goal is to close positions within the hour of opening. For example; if the position opens at 9:04 AM we would require that it close by 10:00 AM. On the other hand, if a position opens at 9:55 AM, that position would close at 11:00 AM not 10:00 AM due to the shortness.

    There needs to be a minimum amount of time, not less than, 30 minutes, but it too must close on the hour.

    #2
    Hello Kathir,

    Thanks for your post and welcome to the Ninjatrader forums!

    The strategy builder is limited in the area of working with time elements and you have a variable condition of time and then a variable condition of rounding time up. These operations are not possible in the strategy builder. They could be done directly in Ninjascript which is based on C# and you would have access to all of the time methods.

    An alternative you may wish to test in the strategy builder is to use the method Bars since entry which will return the number of bars since the entry was filled. This can be found in the condition builder Misc folder. If you are using time-based bars then this would seem to be a way to ensure you have a "minimum" number of bars before exiting.

    Comment


      #3
      Hello Kathir,

      Thanks for your reply.

      For your understanding, we do not provide coding services.

      If you would like this created for you, on your request, we can provide references to 3rd party programmers that you could contact for this service.

      Comment


        #4
        Hello Kathir,

        Thanks for your reply.

        You wrote, " But i have one doubt where i wrote my custom logic coding in ninjascript?"

        I'm not sure what you are asking for, can you clarify?

        Comment


          #5
          Hello Kathir,

          Thanks for your reply.

          For the strategy builder, please see:

          "How to create time filters" https://ninjatrader.com/support/help...on_builder.htm

          Complete strategy builder help guide: https://ninjatrader.com/support/help...gy_builder.htm

          Free live webinar training on the strategy builder (you can ask questions in the live webinar), every other Thursday (alternates with Ninjascript editor): https://ninjatrader.com/PlatformTraining

          Previous recording of the strategy builder webinar: https://www.youtube.com/watch?v=HCyt...We0Nf&index=11

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          66 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          141 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          46 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          51 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X