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

Fast MA reversing/failing at slow MA

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

    Fast MA reversing/failing at slow MA

    Just wondering if anyone has created an indicator (or strategy for that matter) that is based at least partially on a change in direction, "hook around", "U-turn", "reversal" or whatever you might want to call the pattern created by a (user-definable) fast moving average (MA) turning around in close proximity to a longer term (once again ideally user-definable) moving average of some sort.

    (see illustration in attached pic)

    Note that in recognizing the "reversal" or whatever you might want to call it, the fast MA does NOT have to actually cross the slow MA in question, I want the strategy to recognize BOTH.

    i.e. it is NOT a simple crossover methodology; it is the recognition of a short term trend FAILING at a longer term trend...this is very powerful as a trading signal.

    This seems simplistic but it is not (at least for a novice programmer like me...)

    Any insights, examples, bits of code links to other threads etc would be greatly appreciated.
    Attached Files

    #2
    Hi Zigman,

    The first step in developing your strategy is breaking down the ruleset objectively into terms that a computer can understand. There is just no place in code or the strategy wizard to place terms like "hook around", "U-turn", "reversal".

    Take a look at MACD indicator, which measures the difference between two moving averages.

    Once you have an objective ruleset, you can move on to the next step of implementing it. You can create a lot of strategies in strategy wizard or have more control by working with code. If you have limited time or programming experience, consider a NinjaScript consultant to create for you:
    Last edited by NinjaTrader_RyanM1; 03-19-2012, 01:57 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Fast MA reversing/failing at slow MA

      Thanks for responding so quickly Ryan,

      I may well end up hiring someone to do it for me, but ultimately I need to I need to learn/understand it myself so I can tweak as necessary.

      From an approach standpoint, the best method I can think of would be to have the algorithm measure the slope of the fast MA (must exceed certain slope) and the have price come within "x" pips of the slow MA followed by a reversal of the slope of the fast MA (must exceed certain slope) using look back features to ensure that all of this occurs within say 25 bars (on a 1 range chart of the USD/EUR)

      I'm hoping that someone has tackled this concept so I don't have to re invent the wheel...or worse: pay for having it reinvented.

      Any similar posts/code snippets (I've been looking!) would be awesome.

      I will share anything I find here.

      Cheers !

      Comment


        #4
        Great, that's looking better and a step closer to start developing your idea into a NinjaScript strategy. I'm not aware of this idea exactly, but hopefully the concept rings with other community members reading the thread and they could offer some feedback.

        If you want to get started on it, just keep in mind that it doesn't have to be done all in one shot. You've got some components you want to work with, so start getting their values down, printing them to see what's returned using Tools menu > Output Window.

        Here's a snippet you could use to get started checking out the slope of two different length MAs. The slope uses a lookback of 10 bars to measure.

        Code:
        double fastSlope 	= Slope(SMA(7), 10, 0);
        double slowSlope	= Slope(SMA(20), 10, 0);
        		
        Print("Fast Slope: " + fastSlope + " Slow Slope: " + slowSlope);
        Last edited by NinjaTrader_RyanM1; 03-20-2012, 01:44 PM.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DayTradingDEMON, Today, 09:28 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        8 responses
        31 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by helpwanted, Today, 03:06 AM
        2 responses
        22 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by navyguy06, Today, 09:28 AM
        0 responses
        5 views
        0 likes
        Last Post navyguy06  
        Started by rjbtrade1, 11-30-2023, 04:38 PM
        2 responses
        77 views
        0 likes
        Last Post DavidHP
        by DavidHP
         
        Working...
        X