TradingView
DasanC
30 sep 2020 23:09

MESA Adaptive Moving Average - MTF and Divergence analysis 

British Pound/Japanese YenFXCM

Beskrivning

The latest iteration of the MESA Adaptive Moving Average - rewritten to make use of Pinescript v4 Arrays.

Explanation of settings and example use cases:
Fast Limit: Lower values will reduce the reactivity of the MA to rapid price changes.
-For instance, if you want to ignore price spikes on a low timeframe, then reduce Fast Limit
Slow Limit: Lower values will reduce the reactivity of the MA to slow price changes.
-For instance, if you want the MA to ignore small retracements during a trend, then reduce Slow Limit
Show MESA for next higher timeframe: Display the MA of the next standard timeframe that TV offers.
-[I]Displays 3min if the chart timeframe is 1min. Displays D if the chart timeframe is 4H. Does not work with custom timeframes.
Show MESA for custom higher timeframe: Display a secondary MESA plot with a custom timeframe, selectable via the Custom Timeframe drop-down. Overrides the previous setting, if enabled. This functionality is experimental since it provides a higher sample rate than would normally be available. Take precautions making entries using only Custom Timeframe MESA.
-For instance, you made a decision on the 4H chart using MESA and are now watching the 15min to time a trade entry. Enable and select "4H" from the drop-down menu
Show Divergence between MESA Timeframes: Since divergence can differ greatly between assets, we form a baseline by continuously tracking the difference between the chart MA and higher timeframe MA. We note the maximum divergence in each direction (bullish and bearish). A white circle is plotted when divergence is close to the historical maximum. When a record-breaking divergence occurs, a yellow circle is plotted. You can tweak these indications by adjusting the Divergence Threshold %
-Multi-timeframe divergence is typically a weak indication of trend exhaustion, especially if Volume is not present.
Show Divergence between Source & MESA: Again, divergence can differ greatly between assets. This time, we form a baseline by continuously tracking the difference between the chart MA and Source (usually Close). We note the maximum divergence in each direction (bullish and bearish). A purple triangle is plotted when divergence is close to the historical maximum. When a record-breaking divergence occurs, a lime-green triangle is plotted. You can tweak these indications by adjusting the Divergence Threshold %
-Price divergence is a strong indicator of over-extension. It works well for timing reversals on intraday timeframes.
Source: The input data to perform MESA calculations on.

I've really enjoyed trading with this indicator, especially when combined with my previous two tools:
Empirical Suite: factors Trend, Price momentum, Volume, and Volatility
Squeeze Zone: provides a visual representation of volatility squeezes and attempts to predict breakout directions

Use this indicator to get a sense of overall trend, from any chart timeframe, as well as indications of over-extensions and exhaustion.

Kommentarer
Parimal_S
Thank You for this gift!
Tommy_bnks
simply great!
bonfireAlgorithm
Very nice indicator! Would be great if it also had alerts for trend changes and price crossing the MAMA line. Something along these lines:

alertcondition(cross(close, MAMA), title = "Crossing MAMA", message = "Crossing MAMA")
alertcondition(crossover(MAMA, FAMA), title = "Trend change up", message = "Trend change up")
alertcondition(crossunder(MAMA, FAMA), title = "Trend change down", message = "Trend change down")

I know you can set this up manually in alerts, but with custom alerts it's easier and faster.
DasanC
@bonfireAlgorithm, Alerts, unfortunately, do not work for indicators. See tradingview.com/pine-script-docs/en/v4/annotations/Alert_conditions.html?highlight=alertcondition

"While the presence of alertcondition calls in a Pine strategy script will not cause a compilation error, alerts cannot be created from them."
bonfireAlgorithm
@EmpiricalFX, Not sure I understand what you mean exactly. I know alerts won't work in strategies, but they should work for indicators. I've added alerts to several indicators with no problem. Sometimes you will get a repaint warning when activating an alert (usually when MTF data is involved I think), but the alerts I mention should work just fine regardless of the warning.
DasanC
@bonfireAlgorithm, Oops you're right. For some odd reason I was thinking this study was a strategy. Yes, I can add alerts based on your suggestion and I'll also include alerts for the trend exhaustion and reversal indications.
bonfireAlgorithm
@EmpiricalFX, Much appreciated, I was a big fan of your previous MTF MESA indicator, and this one's even better!
Pratik_4Clover
Hi! I checked this indicator with setting for manual higher tf option, when I set for 45 min and compare it to MTF option of your previous mesa script (published on 4th aug), there is some difference with the plot, can you tell if this is change with calculation or something else? If it is what has changed?
DasanC
@OWL, On the Previous release the defaults for Fast Limit and Slow Limit are different, which causes the plot calculation to change. I've made these parameters available via settings this time around.
Pratik_4Clover
@EmpiricalFX, Thank you for clarification ^^
Mer