Indicator · Pine Script v4 · On the chart

Engulfing Candles - VWMA

by tistaharahap· code credited to tista

This overlay indicator marks bullish and bearish engulfing candles with teal and orange arrows on the price chart.

View on GitHub

GitHub stars25on the repository
Pine versionv4older, still runs
Lines of code23
Settings4inputs
LicenceNone statedfile: MPL-2.0
Last update6 years ago29 Jun 2020

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

23 lines of Pine Script v4 from reversals/engulfing-vwma.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

engulfing-vwma.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tista

//@version=4
study("Engulfing Candles - VWMA", overlay=true)

useEmaAsConfirmation = input(true, title="Use VWMA As Confirmation?", defval=false)
showEma = input(false, title="Show VWMA Line?", defval=false)
emaPeriod = input(21, title="VWMA Period (Surpress noise with higher VWMA periods)", defval=21)
emaPeriod2 = input(200, title="VWMA Period for second line (not used for calculation)", defval=200)

emaVals = vwma(close, emaPeriod)
ema2Vals = vwma(close, emaPeriod2)

isBullishEngulfing = open[1] > close[1] and open >= close[1] and open <= close[1] and close >= open[1] and (useEmaAsConfirmation ? close <= emaVals : true)
isBearishEngulfing = open[1] < close[1] and open <= close[1] and open >= close[1] and close <= open[1] and (useEmaAsConfirmation ? close >= emaVals : true)

vals = isBullishEngulfing ? 1 : isBearishEngulfing ? -1 : na

// plotbar(open, high, low, close, title="Engulfing Candle", color = colors)
plotarrow(vals, title="Engulfing Candles", colorup=color.teal, colordown=color.orange, transp=40, maxheight=15)
plot(showEma ? emaVals : na, title="VWMAPrimary", color=showEma ? color.blue : na, linewidth=2, transp=0)
plot(showEma ? ema2Vals : na, title="VWMASecondary", color=showEma ? color.yellow : na, linewidth=2, transp=0)

Overview

An optional volume-weighted moving average can filter those marks: a bullish signal requires the close at or below the primary VWMA, and a bearish signal requires the close at or above it. Two VWMA lines, with independent periods, can be shown or hidden, but only the primary period is used in the filter. It has no entry, exit, or stop rules.

Details

Published by

tistaharahap on GitHub

Code credit

tista, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Candlestick patterns, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Use VWMA As Confirmation?boolfalseuseEmaAsConfirmation
Show VWMA Line?boolfalseshowEma
VWMA Period (Surpress noise with higher VWMA periods)int21emaPeriod
VWMA Period for second line (not used for calculation)int200emaPeriod2
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

285 stars

Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a

Indicator v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Study

Smoothed candles

by be-thomas
65 stars

This indicator draws smoothed candlesticks on the price chart. It applies a simple moving average of a user-set length, defaulting to nine, separately to open, high, low, and close, then plots those four values with plotcandle. Wick color is green when the raw

Indicator v5 Moving averagesCandlestick patterns
Updated 4 days ago · GPL-3.0 GitHub repository of Smoothed candles

Major Buy Setup

by dcaoyuan
55 stars

Major Buy Setup plots a 20-period and a 50-period simple moving average on the price chart. It marks a buy when the current bar is both a bullish engulfing candle and a bald bull candle, defined as a green candle whose upper shadow is no more than five percent

Indicator v5 Moving averagesCandlestick patterns Repaints
Updated 6 months ago · Apache-2.0 GitHub repository of Major Buy Setup

30 min Pivot

by ChartsLector
41 stars

30 min Pivot is an overlay indicator that plots an exponential moving average (EMA) calculated from a specified timeframe (default 30 minutes) and flags specific multi-bar candle setups. It checks the relative distance between price and the higher-timeframe EM

Indicator v5 Moving averagesCandlestick patterns
Updated 2 days ago · None stated GitHub repository of 30 min Pivot

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers