TradingView
io72signals
2020년 10월 19일 오후 10시 5분

72s: Adaptive Hull Moving Average+ 

Euro Fx/U.S. DollarFXCM

설명

One challenging issue for beginner traders is to differentiate market conditions, whether or not the current market is giving best possibility to stack profits, as earliest, in shortest time possible, or not.

On intraday, we've seen some big actions by big banks are somewhat can be defined --or circling around-- by HMA 200. I've been thinking on to make the visuals more conform to price dynamics (separating major movement and minor noise) to get clearer signs of when it starts to happen. So it will be easier to see in a glance when the strength starts really taken place, with less cluttered chart.

This Adaptive HMA is using the new Pine Script's feature which now support Dynamic Length arguments for several Pine functions. ( read: tradingview.com/blog/en/pine-functions-support-dynamic-length-arguments-20554/). It hasn't support the built-in HMA() directly, but thankfully we can use its wma() formula to construct. (Note: I tweaked a bit HMA formula already popular here by using plain int() instead of round() on its wma's length, since I find it precisely match tradingview's built-in HMA).

You can choose which aspect the Adaptive HMA period will adapt to.

In this study I present it with two options: Volume and Volatility. It will "moves" faster or slower depends on which situation the aspect is currently into. ie: When volume is generally low or volatile readings is not there, price won't move very much, so the adapting MA will slow down by dynamically lengthen the lookback period, and vice versa, and so on.

Colour-markings in the Adaptive resembles which situation explained above. In addition, I also combine it with slope calculation of the MA to help measuring trend-strength or sideway/choppy conditions.

This way when we use it as dynamic support/resistance it will be more visually-reliable.

Secondly, and more important, it might help us traders with better probability info of whether or not a trade should even worth to be made. ie: If in the mean time market won't give much movement, any profit would also only as much. In most cases, we might better save our dime for later or place it somewhere else.

HOW TO USE:
Aside from better dynamic support/resistance and clearer breakout confirmation, MA is coloured as follow:
  • YELLOW:
    Market is in consolidation or flat. Be it sideways, choppy, or in relatively small movements. If it shows up in a trending market, it may be an earlier sign that current trend might about to change its direction, or confirming a price broke-out to another side.
  • LIGHT GREEN or LIGHT RED:
    Tells if a trend is forming but still relatively weak (or getting weaker), as it doesn't have volume or volatility to support.
  • DARKER GREEN ot DARKER RED:
    This is where we can expect some good and strong price movement to ride. If it's strong enough, many times it marks a start of new long-lasting major trend.


SETTINGS:
  • Charger:
    Choose which aspect your HMA should plug itself into, thus it will adapt to it.
  • Minimum Period, Maximum Period:
    172 - 233 is just my own setting to outmatch the static HMA 200 for intraday. I find it --in my style of trading-- best in 15m tf in almost any pair, and 15m to 1H for some stocks. It also works nicely with conventional EMA 200, sometimes as if they somewhat work hand-in-hand in defining where the price should go. But you can, ofcourse, experiment with other ranges, broader or narrower. Especially if you already have an established strategy to follow to. As you might do with:
  • Consolidation area threshold:
    This has to do with slope calculation. The bigger the number means your MA needs bigger degree to define the market is out of flat (yellow) area. This can be useful if needed to lighten up the filter or vice-versa.
  • Background colouring:
    Just another colouring to help highlighting the difference in market conditions.


ALERTS:
There are two alerts:
  • Volume Break: when volume is breaking up above average, and
  • Volatility Meter: when the market more likely is about to have its moment of the big wiggling brush.


USAGE:
  • Very very nice BUY entry to catch big up-movement if:
    1. Price is above MA. (It is best when price is also not to far distance from the MA, or you can also use distance oscillator to help out too)
    2. HMA's color is in darker green. Means it's on the charging plug with your chosen aspect.
    3. RSI is above 50. This is to help as additional confirmation.

  • Clear SELL entry signal is same as above, just the opposite.


-------------------------------------------------------

Note:
Lower timeframe of course means more noise to be filtered. Depends on the instrument, you might need to tweak the settings a bit till it conform nicely and shows lots of good trades in history. Here's another example on GBPUSD 5m timeframe:



For exit/take-profit point, you can use a second faster period static HMA. Or you can also use RSI. Here's an example:



Don't get me wrong, on few occasions I found it's still best using static MA to spot fakeouts, breakouts, etc, especially ones that's been already use widely. If that's the case or price actions seems suspicious, simply put the same value for minimum and maximum period settings, and there you have the original HMA with extra features.

For developer, check in the code if you need to customise your own charger.


-------------------------------------------------------


That's it. Hopefully this Adaptive HMA+ could at least be a good sidekick to your own strategy, as it does mine. ;)



릴리즈 노트

Volume aspect: now using smoothed RSI-Volume to better filtering out noise on higher timeframe.

릴리즈 노트

  • fixed "line 40: The function 'anonym_function_0' ..." warning message. Thanks @biswad for this feedback.

  • small optimisation in slope colouring to catch earlier meaningful change.


Tips from several users: For lower timeframe, you might want to use broader minimum-maximum period settings, like 55 - 233 (I myself found a bit KAMA-like behaviour using this settings). Or 21-55 for exits (depends or your strategy).

Hope everyone gets consistency catching big breakout with far less drawdown since this script was published ;)

릴리즈 노트

Re-update (instruction screen moved to the right in last update).
Nothing changed in indicator.

릴리즈 노트

Update some features to indicator:

2ND MINOR ADAPTIVE HMA+
Can be use for alternative exit point or assist analysis. Consider this as a sidekick to the main/bigger/slower adaptive HMA+. Enable and set this up according to your strategy in Indicator's Settings.

DISTANCE ZONE
Helps measuring price's distance to MA as described above in first release, and else. It comprises of 4 sections, such as this:


Also if you are like me who'd like to treat MA as a "leading" indicator in context of its function as a dynamic support/resistance, you can use the zones in conjunction with that concept. Remember in first description that this adaptive MA is built to also have a better visual of dynamic support/resistance from big moves. So for example, we can use them as an added confirmation from reversals & breakouts, the same snapshot screen above can also be seen like this:


PLOT SIGNALS
You can now enable to show signals of possible buy, sell, exits, and also cautious sign when price is too far off distance from MA. Need to note that all signals generated are of this indicator only without considering other measurement like RSI, price actions, or other data just like what we would do in a complete strategy. Hope this can give more flexibility (and opportunity) in usages and settings.

- Buy/Sell; Nothing changed, is as described, or the same like what @Daveatt has also put in comment section below.
- Exit Point; is when price crossed up/down 2nd faster xHMA+, and main xHMA+ is not in state of darker green or darker red.
- Cautious sign; Of course we can treat both Exit Point and Cautious Sign as good TP points when our current position is in profit. But aside from that, it can also serve as another layer of information to help check validity of the next signal. Let's check the same screen in different snapshot based on signal's plot only:


ALERT
Updated to new alert(). Check in the code.


---
Lastly, there's also a sample of implementation of this indicator into a workable strategy with RSI I've also published in here
tradingview.com/script/FrjeeWdl-72s-Strat-Backtesting-Adaptive-HMA-pt-1/
If you later compare the two, the signals there has been filtered with RSI and the Distance Zone recently updated here.

That's it the update for today, good luck with your trading everyone!
코멘트
PineCoders
io72signals
@PineCoders, thank you, happy new year everyone! :)
DaytimeTinkerer
@io72signals, hi where can i find the xRsi , the one used in the very first chart of this page. Thanks you.
mentalAuthor84873
@PineCoders, I swear if I'm profitable, I'll come there again and give money. I'm stunned by this indicator.
Bitboy17
Hi great script thanks so much for the share! Can the indicator be used on daily and weekly timeframes also?
io72signals
@Bitboy17, I believe so, because this is just like any other MA that guide us the average prices, but this one adapt to the volatility more.
For Daily tf, to catch major trend earlier I use different strategy (in combination with this), but I use this MA heavily as an exit strategy, to tell me precise exit points (as to not get out too soon or too late to maximise profits). You would want to lower both your minimum-maximum period to use it as an exits points. Experiment until it match your instrument and you see satisfying exits all-over your chart.

I rarely trade in Weekly tf, so I can't comment. But one of my clients does, and he use earlier version of this (same MA result, little bit different algorithm). Just remember this adapting HMA+ is still new, so we won't get hard-proof confirmation in timeframe bigger than Daily, aside from backtesting, the proper one that is, of course.
Bitboy17
@io72signals, thanks for quick reply. On Daily tf I'll definitely look to lower minimum-maximum periods to help optimise exit points. Cheers for heads up on this.

On the charts above there are also red/green arrows showing trend changes. Is there a way to turn these arrows on as I couldn't see an option in the indicator settings (?)
io72signals
@Bitboy17, those arrows are just me using tv's drawing tools to illustrate one of many possible ways to use of this MA. Really we can get so many infos and market clues from this MA, not just a buy/sell signal :)
But yea maybe later I'll publish on overlay version of this with buy/sell signal plots.
Bitboy17
@io72signals, Hi you mentioned I should lower both minimum-maximum periods. Is this just to use the indictor on exits points? or do I have to change settings for general use on daily timeframe? If I want to see colour changes on daily timeframe can I just leave on the default settings?
io72signals
@Bitboy17, sure you can just leave it to the default settings, for me yes it is safer that way so I won't get to open position too often (it's just my style), BUT I think it'll all comes down to how you want to or usually trade.

As a sample for Daily tf, one user friend who likes more entry opportunity use 21-253 (from 21 days a month and 253 trading day a year). You can simply adjust it your Daily chart across the screen to get what satisfy you most (what make more sense to you), you will see that colour change will always adapt/adjust itself to get you best movement info and opportunity.

For exits, yes I recommend to use smaller range of periods, logically we need to take action when trend starts to move the other way, that is.. unless we know the future :D. You can use two Adaptive HMA+ (one for entry one for exits).

After you satisfy with the visuals, you might wanna try it with REPLAY feature, make your entry-exit rules, and do the manual backtest. Measure your winrate and pips in a year, it should be quite powerful and prevent you from many bad trades. Hope you find it useful. Don't forget to send me thanks later :)
더보기