OPEN-SOURCE SCRIPT

Murat MACD-V

// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © jamiedubauskas

//version=5
indicator(title = "Murat MACD-V", shorttitle = "M-MACD-V", overlay = false, timeframe="", timeframe_gaps=true)

// asking for inputs for the parameters of the MACD-V indicator
fast_len = input.int(title = "MACD Fast Length", defval = 10, minval = 1, group = "Indicator Settings")
slow_len = input.int(title = "MACD Slow Length", defval = 30, minval = 1, group = "Indicator Settings")
source = input.source(title = "Source for TF", defval = close, group = "Indicator Settings")

signal_len = input.int(title = "Signal Line Smoothing Length", defval = 8, minval = 1, group = "Indicator Settings")
atr_len = input.int(title = "ATR Length", defval = 25, minval = 1, tooltip = "Used to gauge volatility to standardize MACD. Keep at the same value as the MACD Slow Length parameter for best results", group = "Indicator Settings")
overbought_bounds = input.int(title = "Overbought Bounds", defval = 150, minval = 1, tooltip = "Threshold for MACD Line to cross above to be considered overbought. Original author of MACD-V placed it at 150.")
overbought_belly = input.int(title = "Overbought Belly", defval = 45, minval = 1, tooltip = "Threshold for MACD Line to cross above to be considered overbought. Original author of MACD-V placed it at 50.")
oversold_belly = input.int(title = "Oversold Belly", defval = -45, maxval = -1, tooltip = "Threshold for MACD Line to cross below to be considered oversold. Original author of MACD-V placed it at -50.")
oversold_bounds = input.int(title = "Oversold Bounds", defval = -150, maxval = -1, tooltip = "Threshold for MACD Line to cross below to be considered oversold. Original author of MACD-V placed it at -150.")

// indicator calculation
macd = ((ta.ema(source, fast_len) - ta.ema(source, slow_len)) / ta.atr(atr_len)) * 100
signal = ta.ema(macd, signal_len)
hist = macd - signal

// asking for input for the color of the macd and signal lines
macd_color = input.color(title = "MACD Line", defval = #2962FF, group = "Color Settings")
signal_color = input.color(title = "Signal Line", defval = #ff6f0005, group = "Color Settings")

// getting colors for the histogram
col_grow_above = input(#26A69A, "Above Grow", group="Histogram", inline="Above")
col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above")
col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below")
col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below")

macd_plot = plot(title = "MACD Line", series = macd, color = macd_color)
plot(title = "Signal Line", series = signal, color = signal_color)
plot(hist, title="Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below)))


// plotting horizontal lines for overbought and oversold bounds
upper_band = plot(overbought_bounds, title = "Overbought Bounds", color = color.new(color.white,68))
upper_belly = plot(overbought_belly, title = "Overbought Belly", color = color.new(#1b7200, 50))
lower_band = plot(oversold_bounds, title = "Oversold Bounds", color = color.new(color.white,68))
lower_belly = plot(oversold_belly, title = "Oversold Belly", color = color.new(#8d0000, 50))

// filling between the lines and the bounds if overbought or oversold
overbought_color = macd > overbought_bounds ? color.new(color.red,30) : na
oversold_color = macd < oversold_bounds ? color.new(color.green,30) : na
fill(macd_plot, upper_band, color = overbought_color, title = "Overbought Fill")
fill(lower_band, macd_plot, color = oversold_color, title = "Oversold Fill")

// extending out the boundaries
extended_upper_band = hline(overbought_bounds, title = "Overbought Bounds Extended", color = color.new(#2e2e2e, 68), linestyle = hline.style_solid)
extended_lower_band = hline(oversold_bounds, title = "Oversold Bounds Extended", color = color.new(#2e2e2e, 68), linestyle = hline.style_solid)

fill(extended_upper_band, extended_lower_band, color = color.new(color.white, 95), title = "Normal Bounds Background Extended")
hline(0, color= color.new(#2e2e2e, 68), linestyle = hline.style_dotted)

Candlestick analysisChart patternsCycles

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?


Murat Oers (CFTe)
他のメディア:

免責事項