LucF

5 MAs w. alerts [LucF]

LucF 已更新   
Is this gazillionth MA indicator worth an addition to the already crowded field of contenders? I say yes! This one shows up to 5 MAs and 6 different marker conditions that can be used to create alerts, among many other goodies.

Features
  • MAs can be darkened when they are falling.
  • MAs from another time frame can be displayed, with the option of smoothing them.
  • Markers can be filtered to Longs or Shorts only.
  • EMAs can be selected for either all or the two shortest MAs.
  • The background can be colored using any of the marker states except no. 3.
  • Markers are:
  • 1. On crosses between any two user-defined MAs,
  • 2. When price is above or below an MA,
  • 3. On Quick Flips (a specific setup involving a cross, multiple MA states and increasing volume, when available),
  • 4. When the difference between two MAs is within a % of its high/low historic values,
  • 5. When an MA has been rising/falling for n bars,
  • 6. When the difference between two MAs is greater than a multiple of ATR.
Some markers use similar visual cues, so distinguishing them will be a challenge if they are used concurrently.

Alerts
Alerts can be created on any combination of alerts. Only non-consecutive instances of markers 5 and 6 will trigger the alert condition. Make sure you are on the interval you want the alert to run at. Using the “Once Per Bar Close” trigger condition is usually the best option.

When an alert is created in TradingView, a snapshot of the indicator’s settings is saved with the alert, which then takes on a life of its own. That is why even though there is only one alert to choose from when you bring up the alert creation dialog box and choose “5 MAs”, that alert can be triggered from any number of conditions. You select those conditions by activating the markers you want the alert to trigger on before creating the alert. If you have selected multiple conditions, then it can be a good idea to record a reminder in the alert’s message field. When the alert triggers, you will need the indicator on the chart to figure out which one of your conditions triggered the alert, as there is currently no way to dynamically change the alert’s message field from within the script.

Background settings will not trigger alerts; only marker configurations.

Notes
MAs are just… averages. Trader lure would have them act as support and resistance levels. I’m not sure about that, and not the only one thinking along these lines. Adam Grimes has studied moving averages in quite a bit of detail. His numbers point to no evidence indicating they act as support/resistance, and to specific MA lengths not being more meaningful than others. His point of view is debated by some—not by me. Mean reversion does not entail that price stops when it reaches its MA; rather, it makes sense to me that price would often more or less oscillate around its MA, which entails the MA does not act as support/resistance. Aren’t the best mean reversion opportunities when price is furthest away from its MA? If so, it should be more profitable to identify these areas, which some of this indicator’s markers try to do.

I think MAs can be much more powerful when thought of as instruments we can use to situate price events in contexts of various resolutions, from the instantaneous to the big picture. Accordingly, I use the relative positions and slopes of MAs in both discretionary and automated trading; but never their purported ability to support/resist.

Regardless of how you use MAs, I hope you will find this indicator useful.

Biased References
The Art and Science of Technical Analysis: Market Structure, Price Action, and Trading Strategies, Adam Grimes, 2012.
Does the 200 day moving average “work”?
Moving averages: digging deeper

版本注释:
Converted to v4.
For each of the 5 MAs, added independent choice of:
- 9 different MA types: SMA, EMA, RMA, WMA, KAMA, VWMA, ALMA, Lin Reg, HMA.
- Higher timeframe selection
- Source
You have the possibility of smoothing higher timeframe MAs.
You can choose to have higher timeframe MAs repaint or not.
You can choose to have high markers in green or red for the markers that plot dots above/below price or on MAs.

Chart shows a 5 and 15 EMA with 50, 200 and 400 KAMAs. The background is colored on the closes above/below MA3 (marker 2).
Active markers are:
- Marker 1: set to crosses between M1 and M4
- Marker 3: Quick Flips
If an alert was configured now, it would trigger on either marker 1 or 3, since they are active, and you could configure the indicator to trigger alerts on longs or shorts only.
版本注释:
Updated comments.
版本注释:
Updated comments.
版本注释:
Added possibility to define an interval for each MA above which the MA is hidden. The default for MA4 and MA5 is 1D, so they are automatically hidden on this 3D chart.
版本注释:
Fixed comments.
版本注释:
Reorganized Inputs.

"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

www.tradingview.com/u/PineCoders/
www.tradingview.com/u/TradingView/
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?