Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Flat Stochastic Filter

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

    Flat Stochastic Filter

    ​Hi, I'm making a strategy in strategy builder and want to create a filter for a flat stochastic line so it doesn't take a trade when it looks like the screengrab below. The screengrab is 10 bars of flatline (the grey D line). This line is not always in the same location, but the flatness does not deviate more 5 points up or down for the duration.

    I can't just program it for a specific range because sometimes it's in the 50's, others it's on the 40's or 60's, and often a good trade occurs as the D line passes through one of those ranges. It's the flatline that's the issue.

    Using strategy builder can you please help me with how I can prevent trades from happening when there's a flatline like this?

    Click image for larger version

Name:	image.png
Views:	66
Size:	2.9 KB
ID:	1325253​​

    Last edited by mmenigma; 11-20-2024, 08:52 PM.

    #2
    Hello mmenigma,

    What are the specific rules you are wanting?

    For example do you want to compare the last 9 bars to be less than or equal to the value of 10 bars ago plus 5 and greater than or equal to the value of 10 bars ago minus 5?

    You would want to add 10 conditions to the condition set for greater and 10 conditions for less, with bars ago set to 0 to 9, each comparing to the stochastics with bars ago 10 with the offset value set to 5.

    Click image for larger version  Name:	2024-11-21_6-32-59.png Views:	0 Size:	74.2 KB ID:	1325280
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thank you for your input and details.

      What I want to know is if the current bar is +- 5 point different than 5 bars ago. If it is, it's ok to trade. 1, 2, 3, or 4 bars ago is not important to me. I want to be sure I have the <= or >= in properly with the correct +5 or -5.

      So if the current bar is at 40, and 5 bars ago it was less than 35 or greater than 45, it's ok to trade.


      Will this accomplish that? I followed what you did in your example and have Less than sign with +5 and the greater than sign with -5.

      Click image for larger version  Name:	image.png Views:	0 Size:	23.4 KB ID:	1325306

      Thanks, Mitch​
      ​​
      Attached Files
      Last edited by mmenigma; 11-21-2024, 01:51 PM.

      Comment


        #4
        Hello mmenigma,

        If you want to compare the current bar's value to be greater than the value of 5 bars ago plus 5 (in the offset), then use Greater (>) instead of Less Equal (<=) and do the same
        Same for being less than 5 bars ago minus 5.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi, so this will work to do what's in my pic?

          For some reason the greater sign with the -5 and less sign with +5 seem backwards. But I'm a visual learner and can't really picture the text. So, I'll assume it's correct as you're the professional whose helped me a lot in the past.

          Click image for larger version

Name:	image.png
Views:	42
Size:	23.3 KB
ID:	1325343

          Comment


            #6
            Hello mmenigma,

            In the screenshot I've provided, I've used Bars ago 0 on the left, and Bars ago 10 on the right. With your modification Bars ago would be 5 instead of 10.

            In this latest screenshot you have if the value from 5 bars ago is less than the current bar's value plus 5.
            This would not be the same comparison and would work not the same.

            Take for example if the value on the current bar is 7 and the value from 5 bars ago is 3.

            When comparing the current bars value to be greater than the value from 5 bars ago plus 5:
            7 is not greater than 8. This evaluates as false.

            When comparing the value from 5 bars ago plus 5 to be less than the current bar's value plus 5:
            3 is less than 12. This evaluates as true.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            64 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            139 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
            45 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            50 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X