0% found this document useful (0 votes)
74 views2 pages

Indicator 33

This document is a Pine Script code for a TradingView indicator that implements an Exponential Moving Average (EMA) with customizable length and source. It includes conditions for buy and sell signals based on the closing price relative to the EMA, as well as options for additional smoothing and Bollinger Bands. The script allows for visual representation of the EMA and Bollinger Bands on the chart.

Uploaded by

rihim69961
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views2 pages

Indicator 33

This document is a Pine Script code for a TradingView indicator that implements an Exponential Moving Average (EMA) with customizable length and source. It includes conditions for buy and sell signals based on the closing price relative to the EMA, as well as options for additional smoothing and Bollinger Bands. The script allows for visual representation of the EMA and Bollinger Bands on the chart.

Uploaded by

rihim69961
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

//@version=6

indicator(title="Moving Average Exponential", shorttitle="EMA",


overlay=true, timeframe="", timeframe_gaps=true)

len = input.int(9, minval=1, title="Length")

src = input(close, title="Source")

offset = input.int(title="Offset", defval=0, minval=-500, maxval=500,


display = display.data_window)

out = ta.ema(src, len)

plot(out, title="EMA", color=color.blue, offset=offset)

// Buy en Sell signalen (1 keer tonen per overgang wanneer de hele


candlestick boven of onder de EMA sluit)

var bool lastBuySignal = false

var bool lastSellSignal = false

buyCondition = ta.barssince(close < out) > 0 and close > out and low >
out and not lastBuySignal

sellCondition = ta.barssince(close > out) > 0 and close < out and high <
out and not lastSellSignal

ma(source, length, MAtype) =>

switch MAtype

"SMA" => ta.sma(source, length)

"SMA + Bollinger Bands" => ta.sma(source, length)

"EMA" => ta.ema(source, length)

"SMMA (RMA)" => ta.rma(source, length)

"WMA" => ta.wma(source, length)

"VWMA" => ta.vwma(source, length)

// Smoothing MA plots

smoothingMA = enableMA ? ma(out, maLengthInput, maTypeInput) : na


smoothingStDev = isBB ? ta.stdev(out, maLengthInput) * bbMultInput : na

plot(smoothingMA, "EMA-based MA", color=color.yellow, display =


enableMA ? display.all : display.none, editable = enableMA)

bbUpperBand = plot(smoothingMA + smoothingStDev, title = "Upper


Bollinger Band", color=color.green, display = isBB ? display.all :
display.none, editable = isBB)

bbLowerBand = plot(smoothingMA - smoothingStDev, title = "Lower


Bollinger Band", color=color.green, display = isBB ? display.all :
display.none, editable = isBB)

fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) :


na, title="Bollinger Bands Background Fill", display = isBB ? display.all :
display.none, editable = isBB)

You might also like