Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Avoiding rapid whipsaw orders in non-trending markets

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

    Avoiding rapid whipsaw orders in non-trending markets

    I worked all last night on creating strategies and I feel I've made a lot of progress, I'm quite impressed with NinjaTrader to say the least.

    One remaining difficulty is that when the market isn't trending, I'll sometimes get a many rapid orders in succession as an indicator oscillates around the center point.



    I have a few ideas, but I'm not sure the best way to go about it. And thought I'd run my ideas by the more experienced users here.

    -One solution would be to limit the number of orders within a certain time frame. I noticed "Bars since entry" and "Bars since exit" in the condition builder, could that work somehow?

    -Applying some type of weighting to the order types might help. The MACD avg is below zero, which suggests a downward trend, therefore buy order signals should have less 'weight' than sell orders. One problem with this though is that the best up trends start with the MACD below the zero line. The TrendStrength indicator could be useful in this regard, but seems difficult to optimize for this purpose.

    -Another solution which I feel could be the best involves the MACD difference histogram (shown in the screenshot). As a condition for trading, the average value of the histogram over period X (I could probably make a SMA of the MACD difference) would have to be either greater than 0.x or less than -0.x but not between. Is there some way to do this within the condition builder?

    Can I use range values?
    IF SMA(MACD, difference) is NOT= -0.x - 0.x then place order...


    Any comments or suggestions would be appreciated, thanks.


    #2
    ADX > 30 is supposed to imply trend where a lower value is less trending...How about incorporating that indicator as a filter to see if it may filter out some of the unwanted entries?
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray, I'll try working with that and see if it helps.

      I'm sure its a common problem, so hopefully others can share what has worked for them as well

      Comment


        #4
        Hi elliot i had the exact same issue as you, and i am also new but this is what i did, and it seemed to work well.

        I used the macd histogram like you said:

        Basically the average is the histogram value, So if you choose that in the wizard and say that it has to be > "certain value" ie +.05. or less thatn -.05.

        that way when those multiple crosses are occuring they have to have crossed so far before it will enter a trade. If you dont understand let me know and i will post the code and reexplain.

        It worked great for me

        Comment


          #5
          Hi Elliot, timmyb, have found any other better ways of determining trending or non trending markets beside the MACD Histogram method? Thanks.

          Comment


            #6
            I am using ADX for this also, however I do not care about the actual value of ADX, only its rate of change. In other words, ADX with negative slope implies the current trend is ending and you are either in a ranging market or a new trend is beginning.

            I find that much of the best action happens when ADX is below the 'trending' area, but is steadily sloping up towards it

            Comment


              #7
              Sample Code?

              Originally posted by sefstrat View Post
              I am using ADX for this also, however I do not care about the actual value of ADX, only its rate of change. In other words, ADX with negative slope implies the current trend is ending and you are either in a ranging market or a new trend is beginning.

              I find that much of the best action happens when ADX is below the 'trending' area, but is steadily sloping up towards it
              Sefstrat, Would you mind sharing your code for the ADX Slope?

              Thank you,

              Comment


                #8
                Flat market detection

                Elliot and all,
                I have had pretty good success using the slope of a low lag moving average, such as the Hull MA. A period of 10 to 20 bars, using the Median of the bar (rather than the Close) is fairly smooth as a market goes from trending to flat (and vice versa). With a smooth low lag moving average, a simple slope measurement of the moving average over the last 1 or 2 bars can be compared to a threshold value. If the slope is less than the threshold, the market is considered to be "flat". Otherwise it can be treated as a trending market. The threshold value can be adjusted to the market and the timeframe.

                Hope this helps,

                Bormir

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                558 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X