用分辨率填充 2 MA
Filling 2 MA with resolution
您好,我正在尝试绘制分辨率为 W 的 EMA 和 SMA,并在它们之间填充背景。
这是我的代码:
study("Support Band", overlay=true, resolution="W")
src = input(close)
ema = input(21, minval=1, title='EMA')
sma = input(20, minval=1, title='SMA')
pema = ema(src, ema)
psma = sma(src, sma)
//fil
emaplot = plot(pema, color=#2ecc71, linewidth=1, title='EMA')
smaplot = plot(psma, color=#f00b0b, linewidth=1, title='SMA')
fill(emaplot, smaplot, color=pema>psma? color.rgb(0, 255, 0, 50):color.rgb(255, 0, 0, 50), editable=true, fillgaps=true)
由于某些原因,查看每日时背景没有填充,但查看每周时显示。我试过填充间隙但没有用。任何帮助表示赞赏。
谢谢
早上好,
在多个时间范围内进行测试并且有效。
study(title="Whosebug123", shorttitle="Whosebug123", overlay=true)
len21 = input(21, minval=1, title="Length")
len20 = input(20, minval=1, title="Length")
res = input(title="Resolution", type=input.string, defval="W")
pema = security(syminfo.tickerid, res, ema(close, len21))
psma = security(syminfo.tickerid, res, sma(close, len20))
emaplot = plot(pema, color=#2ecc71, linewidth=1, title='EMA')
smaplot = plot(psma, color=#f00b0b, linewidth=1, title='SMA')
fill(emaplot, smaplot, color=pema>psma? color.rgb(0, 255, 0, 50):color.rgb(255, 0, 0, 50), editable=true, fillgaps=true)
您好,我正在尝试绘制分辨率为 W 的 EMA 和 SMA,并在它们之间填充背景。 这是我的代码:
study("Support Band", overlay=true, resolution="W")
src = input(close)
ema = input(21, minval=1, title='EMA')
sma = input(20, minval=1, title='SMA')
pema = ema(src, ema)
psma = sma(src, sma)
//fil
emaplot = plot(pema, color=#2ecc71, linewidth=1, title='EMA')
smaplot = plot(psma, color=#f00b0b, linewidth=1, title='SMA')
fill(emaplot, smaplot, color=pema>psma? color.rgb(0, 255, 0, 50):color.rgb(255, 0, 0, 50), editable=true, fillgaps=true)
由于某些原因,查看每日时背景没有填充,但查看每周时显示。我试过填充间隙但没有用。任何帮助表示赞赏。
谢谢
早上好,
在多个时间范围内进行测试并且有效。
study(title="Whosebug123", shorttitle="Whosebug123", overlay=true)
len21 = input(21, minval=1, title="Length")
len20 = input(20, minval=1, title="Length")
res = input(title="Resolution", type=input.string, defval="W")
pema = security(syminfo.tickerid, res, ema(close, len21))
psma = security(syminfo.tickerid, res, sma(close, len20))
emaplot = plot(pema, color=#2ecc71, linewidth=1, title='EMA')
smaplot = plot(psma, color=#f00b0b, linewidth=1, title='SMA')
fill(emaplot, smaplot, color=pema>psma? color.rgb(0, 255, 0, 50):color.rgb(255, 0, 0, 50), editable=true, fillgaps=true)