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

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.
          Understand the fundamentals of basic strategy creation by developing an actual strategy using the NinjaTrader Strategy Builder.2:45 Opening a Strategy Builde...


          I am also including a link to a forum post with helpful information about getting started with NinjaScript.


          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 jaybedreamin, Today, 05:56 PM
            0 responses
            7 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            13 views
            0 likes
            Last Post bltdavid  
            Working...
            X