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

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.
    Paul H.NinjaTrader Customer Service

    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.

      Paul H.NinjaTrader Customer 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?
        Paul H.NinjaTrader Customer Service

        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

          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gbourque, Today, 06:39 AM
          2 responses
          14 views
          0 likes
          Last Post gbourque  
          Started by rexsole, Today, 08:39 AM
          0 responses
          4 views
          0 likes
          Last Post rexsole
          by rexsole
           
          Started by trilliantrader, Yesterday, 03:01 PM
          3 responses
          30 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          4 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Brevo, Today, 01:45 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X