에디터즈 픽
OPEN-SOURCE SCRIPT

72s: Adaptive Hull Moving Average+

업데이트됨
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
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!
adaptivebreakouthullMoving AveragesstrategystrengthtrendTrend AnalysisVolatility

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항