Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Average Filter

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

    Moving Average Filter

    Good Evening I hope everyone is having a good weekend.

    I am sure that there is a very simple solution for this. I am attempting to filter my working strategy to only take a trade above or below a certain moving average. For an easy example, (not necessarily the same period moving average I am using), I want it to trade my strategy, but filtering to only take a long if we are above the 15 period SMA, and only take a short if the market is below the 15 period SMA. What combination of parameters must I use to make proper use of this moving average filter line. This seems like an easy solution but I am just not figuring it out. Thanks in advance for your help.

    #2
    Hi Superlite,
    We all started as Junior Members.
    The attached just uses the SMA filter. Add you other conditions and have fun.
    NT-Roland
    Attached Files

    Comment


      #3
      Hi NT-Roland,

      Thanks for the reply and for creating that for me. It seems as though that what you have created is not necessarily filtering, but rather being it's own strategy. The strategy is now using price crossing the SMA line as the entry and exit parameter into the trade rather than using my strategy as as the entry and exit. Do you have any other ideas we could try? Thanks.

      Comment


        #4
        Hello Superlite,
        You can simply add another condition to your existing set of conditions : Close[0] > SMA(15)[0] for long entry & Close[0] < SMA(15)[0] for short entry. Use Strategy Builder so you don't make a mistake. Hope it helps.
        Last edited by s.kinra; 10-17-2020, 11:08 PM.

        Comment


          #5
          Hello Superlite,

          If you have not already watched the Strategy Builder 301 training video I recommend this as a starting place.
          https://www.youtube.com/watch?v=HCyt...We0Nf&index=10

          I am also including a link to a forum post with helpful information about getting started with NinjaScript.
          https://ninjatrader.com/support/foru...040#post786040

          NT-Roland, thank you for your sample code and sample script.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            There is another handy little thing you can do in the strategy builder which is to take the moving average you like and compare it to where it was a certain number of bars ago. SMA(15)[20] > SMA(15)[0]

            In the above example its a great little filter that ensures the moving average itself is falling compared to the same moving average 20 bars ago. This can be in addition to your other filter above. The Ninjatrader staff can correct me if I am wrong.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Kicks.Spin, Today, 07:46 AM
            0 responses
            2 views
            0 likes
            Last Post Kicks.Spin  
            Started by Renejm, Today, 06:17 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by kazisl, Yesterday, 06:41 PM
            2 responses
            10 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by impactX, 05-04-2021, 01:07 AM
            2 responses
            11 views
            0 likes
            Last Post NinjaTrader_Melissa  
            Started by op1031, Yesterday, 05:51 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Working...
            X