OPEN-SOURCE SCRIPT

5 MAs w. alerts [LucF]

Aktualisiert
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

Versionshinweise


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.
Versionshinweise
Updated comments.
Versionshinweise
Updated comments.
Versionshinweise
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.
Versionshinweise
Fixed comments.
Versionshinweise
Reorganized Inputs.
alertsExponential Moving Average (EMA)Moving AveragesSimple Moving Average (SMA)

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?


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

tradingview.com/u/PineCoders/
tradingview.com/u/TradingView/
Auch am:

Haftungsausschluss