//@version=4 study("ytg_DveMashki_ind", overlay=true) ma_1 = input(title="ma_1", type=input.integer, defval=28, minval=1) ma_2 = input(title="ma_2", type=input.integer, defval=144, minval=1) method = input(title="method", defval="Linear Weighted", options=["Simple", "Exponential", "Smoothed", "Linear Weighted"]) price = input(title="price", type=input.source, defval=close) signal = input(title="signal", type=input.integer, defval=14, minval=1) s_method = input(title="s_method", defval="Simple", options=["Simple", "Exponential", "Smoothed", "Linear Weighted"]) signal2 = input(title="signal2", type=input.integer, defval=70, minval=1) s_method2 = input(title="s_method2", defval="Simple", options=["Simple", "Exponential", "Smoothed", "Linear Weighted"]) GetMA(_src,_period,_method) => _value = 0.0 if _method=="Simple" _value := sma(_src,_period) else if _method=="Exponential" _value := ema(_src,_period) else if _method=="Smoothed" _value := ((_period-1) * nz(_value[1]) + _src) / _period else if _method=="Linear Weighted" _value := wma(_src,_period) _value ExtMapBuffer1 = GetMA(price,ma_1,method) ExtMapBuffer2 = GetMA(price,ma_2,method) MACD_Map = ExtMapBuffer1 - ExtMapBuffer2 SignalMap = GetMA(MACD_Map, signal, s_method) SignalMap2 = GetMA(MACD_Map, signal2, s_method2) SignalLine = ExtMapBuffer2 + SignalMap SignalLine2 = ExtMapBuffer2 + SignalMap2 plot(SignalLine, title="SignalLine", color=color.yellow, linewidth=2, style=plot.style_line, transp=00, offset=0, trackprice=false) plot(SignalLine2, title="SignalLine2", color=color.aqua, linewidth=2, style=plot.style_line, transp=00, offset=0, trackprice=false) Ext1 = plot(ExtMapBuffer1, title="ExtMapBuffer1", color=color.purple, linewidth=1, style=plot.style_line, transp=00, offset=0, trackprice=false) Ext2 = plot(ExtMapBuffer2, title="ExtMapBuffer2", color=color.maroon, linewidth=1, style=plot.style_line, transp=00, offset=0, trackprice=false) color_area = ExtMapBuffer2>=ExtMapBuffer1 ? color.new(color.maroon , 40) : color.new(color.purple , 40) fill(Ext1, Ext2, color=color_area , title = "Border")