OPEN-SOURCE SCRIPT

D_Rock's MA Indicator

Updated
D_Rock's Moving Average Indicator


This is an indicator version of my strategy linked here


**Overview:**

The basic concept of this indicator is to generate a signal when a faster/shorter length moving average crosses over (for Longs) or crosses under (for Shorts) a medium/longer length moving average. All of which are customizable. This indicator can work on any timeframe, however the daily is the timeframe used for the default settings and screenshots, as it was designed to be a multi-day swing strategy. Once a signal has been confirmed with a candle close, based on user options, the strategy is to enter the trade on the open of the next candle.

The crossover strategy is nothing new to trading, but what can make this strategy unique and helpful, is the addition of further confirmation points before a signal is generated along with the ability to show multiple moving averages on the chart if you choose. Each moving average pair can also be turned into a "cloud" instead of the traditional lines, for additional viewing preferences. Just about everything visual can be toggled on/off as well.

This indicator is a Trend (MA) indicator with optional confirmation points using a Momentum (MACD) indicator. While a Volume-based indicator is not shown here, one could consider using their favorite from that category to further compliment the signal idea.

If you would like to see the backtesting results for your favorite moving average crossover/under, please see my strategy version linked here.

Shoutout given to Ripster's Clouds Indicator as pieces of that code were taken and modified to create both the Cloud visualization effects, and the Moving Average Pair Plots that are implemented in this strategy.


MOVING AVERAGE OPTIONS
  • Select between and change the length & type of up to 5 pairs (10 total) of moving averages
  • The "Show Cloud-x" option will display a fill color between the "a" and "b" pairs
  • All moving averages lines can be toggled on/off in the "Style" tab, as well as adjusting their colors.
  • Visualization features do not affect calculations, meaning you could have all or nothing on the chart and the strategy will still produce results


SIGNAL CHOICES
  • Choose the fast/shorter length MA and the medium/longer length MA to determine the entry signal


CONFIRMATION OPTIONS
  • Both of these have customizable values and can be toggled on/off
  • A candle close over a slower/much longer length moving average
  • An additional cross-over (cross-under for Shorts) on the MACD indicator using default MACD values. While the MACD indicator is not necessary to have on the chart, it can help to add that for visualization. The calculations will perform whether the indicator is on the chart or not.




ADDITIONAL PLOTS
MACD (Moving Average Convergence/Divergence):
- The MACD is an optional confirmation indicator for this strategy.
- Plotting the indicator is not necessary for the strategy to work, but it can be helpful to visually see the status and position of the MACD if this feature is enabled in the strategy
- This helps to identify if there is also momentum behind the entry signal
Release Notes
Updated the chart to remove drawings
crossoverExponential Moving Average (EMA)Simple Moving Average (SMA)Weighted Moving Average (WMA)

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer