需要帮助将 Pinescript v2 转换为 v4 转换
Need help converting Pinescript v2 to v4 conversion
我一直在尝试将其转换为 v4,但遇到了很多问题,尤其是与将参数传递到 dl 的绘图函数相关的错误。任何帮助或建议将不胜感激。我看过 V3 转换指南。在此先感谢您的帮助。
study(title="EIT", shorttitle="EIT", overlay=true, precision=3)
src=input(hl2, title="Source")
a= input(0.07, title="Alpha", step=0.01)
fr=input(false, title="Fill Trend Region")
ebc=input(false, title="Enable barcolors")
hr=input(false, title="Hide Ribbon")
it=0.0
it:=(a-((a*a)/4.0))*src+0.5*a*a*src[1]-(a-0.75*a*a)*src[2]+2*(1-a )*nz(it[1], ((src+2*src[1]+src[2])/4.0))-(1-a )*(1-a )*nz(it[2], ((src+2*src[1]+src[2])/4.0))
lag=2.0*it-nz(it[2])
dl=0.0
dl:=plot(fr and (not hr)?(it>lag?lag:it):na, color=gray, style=circles, linewidth=0, title="Dummy")
itl=plot(hr?na:it, color=fr?gray:red, linewidth=1, title="Trend")
ll=plot(hr?na:lag, color=fr?gray:blue, linewidth=1, title="Trigger")
fill(dl, ll, green, title="UpTrend", transp=70)
fill(dl, itl, red, title="DownTrend", transp=70)
bc=not ebc?na:(it>lag?red:lime)
barcolor(bc)
这对你有用吗?
//@version=4
study(title="EIT", shorttitle="EIT", overlay=true, precision=3)
src = input(hl2, title="Source")
a = input(0.07, title="Alpha", step=0.01)
fr = input(false, title="Fill Trend Region")
ebc = input(false, title="Enable barcolors")
hr = input(false, title="Hide Ribbon")
var float it = 0.0
it := (a-((a*a)/4.0))*src+0.5*a*a*src[1]-(a-0.75*a*a)*src[2]+2*(1-a )*nz(it[1], ((src+2*src[1]+src[2])/4.0))-(1-a )*(1-a )*nz(it[2], ((src+2*src[1]+src[2])/4.0))
lag = 2.0*it-nz(it[2])
dl = plot(fr and (not hr)?(it>lag?lag:it):na, color=color.gray, style=plot.style_circles, linewidth=0, title="Dummy")
itl = plot(hr?na:it, color=fr?color.gray:color.red, linewidth=1, title="Trend")
ll = plot(hr?na:lag, color=fr?color.gray:color.blue, linewidth=1, title="Trigger")
fill(dl, ll, color.green, title="UpTrend", transp=70)
fill(dl, itl, color.red, title="DownTrend", transp=70)
bc = not ebc?na:(it>lag?color.red:color.lime)
barcolor(bc)
我一直在尝试将其转换为 v4,但遇到了很多问题,尤其是与将参数传递到 dl 的绘图函数相关的错误。任何帮助或建议将不胜感激。我看过 V3 转换指南。在此先感谢您的帮助。
study(title="EIT", shorttitle="EIT", overlay=true, precision=3)
src=input(hl2, title="Source")
a= input(0.07, title="Alpha", step=0.01)
fr=input(false, title="Fill Trend Region")
ebc=input(false, title="Enable barcolors")
hr=input(false, title="Hide Ribbon")
it=0.0
it:=(a-((a*a)/4.0))*src+0.5*a*a*src[1]-(a-0.75*a*a)*src[2]+2*(1-a )*nz(it[1], ((src+2*src[1]+src[2])/4.0))-(1-a )*(1-a )*nz(it[2], ((src+2*src[1]+src[2])/4.0))
lag=2.0*it-nz(it[2])
dl=0.0
dl:=plot(fr and (not hr)?(it>lag?lag:it):na, color=gray, style=circles, linewidth=0, title="Dummy")
itl=plot(hr?na:it, color=fr?gray:red, linewidth=1, title="Trend")
ll=plot(hr?na:lag, color=fr?gray:blue, linewidth=1, title="Trigger")
fill(dl, ll, green, title="UpTrend", transp=70)
fill(dl, itl, red, title="DownTrend", transp=70)
bc=not ebc?na:(it>lag?red:lime)
barcolor(bc)
这对你有用吗?
//@version=4
study(title="EIT", shorttitle="EIT", overlay=true, precision=3)
src = input(hl2, title="Source")
a = input(0.07, title="Alpha", step=0.01)
fr = input(false, title="Fill Trend Region")
ebc = input(false, title="Enable barcolors")
hr = input(false, title="Hide Ribbon")
var float it = 0.0
it := (a-((a*a)/4.0))*src+0.5*a*a*src[1]-(a-0.75*a*a)*src[2]+2*(1-a )*nz(it[1], ((src+2*src[1]+src[2])/4.0))-(1-a )*(1-a )*nz(it[2], ((src+2*src[1]+src[2])/4.0))
lag = 2.0*it-nz(it[2])
dl = plot(fr and (not hr)?(it>lag?lag:it):na, color=color.gray, style=plot.style_circles, linewidth=0, title="Dummy")
itl = plot(hr?na:it, color=fr?color.gray:color.red, linewidth=1, title="Trend")
ll = plot(hr?na:lag, color=fr?color.gray:color.blue, linewidth=1, title="Trigger")
fill(dl, ll, color.green, title="UpTrend", transp=70)
fill(dl, itl, color.red, title="DownTrend", transp=70)
bc = not ebc?na:(it>lag?color.red:color.lime)
barcolor(bc)