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

Have strategy avoid a TTR (tight trend range)

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

    Have strategy avoid a TTR (tight trend range)

    Hello,

    I was wondering if there is a way to stop my strategy from filling orders during a breakout/breakdown from a tight trending range (if high and low of previous 20 bars are within 2-2.5 points)? I'd like it to avoid those explosive moves for the following 2-5 bars after the breakout/breakdown.

    Thank you,
    Chris

    #2
    If it were me, I'd use a threshold based on a numerical minimum value for either the ATR or ADX indicators to take a trade. The short side trades on the ADX have a tendency to run well into the low teens, and still have decent momentum though, so you might want to have different thresholds for long or short trades.
    A minimum threshold for the Bollinger band width is another good option especially to detect the moment when volatility begins to rise.

    Originally posted by chrisca View Post
    Hello,

    I was wondering if there is a way to stop my strategy from filling orders during a breakout/breakdown from a tight trending range (if high and low of previous 20 bars are within 2-2.5 points)? I'd like it to avoid those explosive moves for the following 2-5 bars after the breakout/breakdown.

    Thank you,
    Chris

    Comment


      #3
      Hello Chris,

      If these orders are in a working state and at the exchange, they will have to be cancelled to avoid a fill. Aside from cancelling the order, you could use additional logic to control market orders, or you could use order methods without the isLiveUntilCancelled overload in the Managed Approach and call the order submission methods on each bar only when all of your criteria is met.

      Checking the if the difference between high and low from the last 20 bars are within a certain range can be achieved with a loop.
      Code:
      bool allowSubmission = false;
      for(int i = 0; i < SomeBars; i++)
      	if(High[i]-Low[i] > SomeLowBound && High[i]-Low[i] < SomeHighBound)
      		allowSubmission = true;
      I've included a link to our publicly available documentation on Advanced Order Handling for the thread's reference on isLiveUntilCancelled

      Advanced Order Handling (isLiveUntilCancelled) - https://ninjatrader.com/support/help...ancelledOrders

      Please let me know if I can be of further help.
      JimNinjaTrader Customer Service

      Comment


        #4
        Thanks guys,

        I'll plug in your ideas and see what I can come up with.

        Chris

        Comment


          #5
          If you are inclined and you both have enough width, and want to program it. You could do a short range "reversion to mean" strategy based on price moving back towards the center line of the BB's after having passed outside the upper or lower bollinger band first. And maybe even program it, so that if the price passes not merely that center line but continues through to the opposite BB band and follows it for a while, before falling away from that opposite BB .... that is your exit condition. Your choice. Study what is happening with the indicators immediately prior to a trend, or break out, and I'm sure you begin to pick up on possible patterns.
          good luck.

          Originally posted by chrisca View Post
          Thanks guys,

          I'll plug in your ideas and see what I can come up with.

          Chris

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Barry Milan, Yesterday, 10:35 PM
          5 responses
          16 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by DanielSanMartin, Yesterday, 02:37 PM
          2 responses
          13 views
          0 likes
          Last Post DanielSanMartin  
          Started by DJ888, 04-16-2024, 06:09 PM
          4 responses
          13 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by terofs, Today, 04:18 PM
          0 responses
          12 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by nandhumca, Today, 03:41 PM
          0 responses
          8 views
          0 likes
          Last Post nandhumca  
          Working...
          X