Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter and Exit a strategy on a timely manner

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

    Enter and Exit a strategy on a timely manner

    Hi There,

    I have a strategy that it's based on UniRenko (default) + 15-min bar chart (as secondary series). How do I include the following conditions in my strategy?

    1- Wait till the first 5-min passes. If my conditions are not met, don't take any positions till the next new 15-min bar comes in
    2- If a position is taken, then don't take another one till the next new 15-min bar comes in

    Thank you..

    #2
    Hello Abdullah_KSA,

    Thanks for your post.

    In Item 1, did you mean the first 5 minutes or first 15-minute bar?

    Can you clarify if you are working in the Strategy Builder or the Ninjascript editor to create the strategy?

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello Abdullah_KSA,

      Thanks for your post.

      In Item 1, did you mean the first 5 minutes or first 15-minute bar?

      Can you clarify if you are working in the Strategy Builder or the Ninjascript editor to create the strategy?
      Thank you .. Paul for your kind and prompt reply

      Item#1 is related to the first 5 minutes (of the 15 minutes bar). So, don't take any positions, if the first 5 minutes passes, and my conditions are not met (wait till the next 15 minutes bar shows up).

      I use the script editor manually (not the Strategy Builder). However, my coding knowledge is very modest. I'd really appreciate highlighting the major commands to be used. I can look'em up, and try to educate myself about them. I'd be very thankful if you can generously code it and share it here

      Comment


        #4
        Hello Abdullah_KSA,

        Thanks for your reply.

        While we cannot provide script writing service, what I can suggest is to also add a 5-minute bar series to provide a way to note when the 5 minute period is up.

        You would need to use bool variables (that are either true or false) when the 15-minute bar has called the OnBarUpdate(). This would be when BarsInProgress ==1, at that moment you could set a bool to be true indicating a new 15 minute period and you would use that bool being true as part of your entry conditions.

        You would set the bool to false under the condition of placing an order, to prevent further orders until the next 15-minute bar or if the 5-minute bar (BarsInProgress == 2 (assuming you added it second)) calls OnBarUpDate().

        You'll likely have to play with the logic a bit as the sequence of which data series call OnBarUpdate() is not always in the order that you might think so definitely be prepared to debug with print statements that show the BarsInProgress.

        If you are not familiar with multi-series/Time-frames coding, I highly recommend reviewing the help guide here: https://ninjatrader.com/support/help...nstruments.htm



        Comment


          #5
          Thank you, Paul
          This is really helpful. I shall give it a shot, and revert back with the outcomes
          Appreciate your insights

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          86 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          29 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          32 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          67 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X