较高的时间范围指示器不是最后蜡烛的油漆

发布于 2025-02-10 15:21:09 字数 550 浏览 1 评论 0原文

您好,松木脚本:)

我需要您的帮助。我目前正在学习松木脚本,并且对此有一个新手问题。 我希望我的指示器可以设置在较高的时间范围内绘画,直到较低时间框架的最后一支蜡烛为止。指示器的时间范围越大,越短,远离他的最后一支蜡烛... :( 下面的屏幕截图是在10分钟图表上,在EMA上设置了4小时(与SMA相同)。

谢谢你们:)

tickerid = tickerid(syminfo.prefix,ticker) 时间范围=输入(title =“ wavedeltav2 timeframe”,type = sandolution,defval =“ 30”) myema =安全性(tickerid,时间范围,(ema(关闭,2)),barmerge.gaps_on,barmerge.lookahead_on) 绘图(Myema,“ Ema”,颜色(黄色,75),style = line,lineWidth = 9)

screenshot

Hello Pine Scripters:)

I need your help. I am currently Learning Pine Script and I have one newbie Question regarding it.
I want my Indicator who can be set on higher time frame to paint until the Last candle of the lower time frame. The Bigger the Timeframe of the Indicator, the shorter and away from the last candle he is... :(
The Screenshot below is on 10 min Chart with 4 Hours set on the EMA (its the same with sma).

Thank you guys :)

TickerId = tickerid(syminfo.prefix, ticker)
timeFrame = input(title="WaveDeltav2 Timeframe", type=resolution, defval="30")
MyEMA = security(TickerId, timeFrame, (ema(close, 2)) , barmerge.gaps_on, barmerge.lookahead_on)
plot(MyEMA, "EMA", color(yellow,75), style=line, linewidth=9)

ScreenShot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坐在坟头思考人生 2025-02-17 15:21:09

我们可以使用安全函数将更高的时间范围EMA拉到变量中。然后,我们可以使用较高的TF EMA和电流关闭来计算实时EMA。

在下面的示例中,我将更高的TF EMA在一个称为Myema的变量中提取。如果不是Na,则使用此值设置另一个称为EMA的变量。否则,变量EMA设置为具有自己以前的蜡烛价值。这样,EMA变量将始终包含更高的TF EMA,该TF EMA已计算为最后一个闭合的更高TF蜡烛。

然后,我们使用此更高的TF EMA,并在其上使用下部TF关闭来计算实时EMA。

TickerId = tickerid(syminfo.prefix, ticker) 
timeFrame = input(title="WaveDeltav2 Timeframe", type=resolution, defval="30")  
ema=0.0
MyEMA = security(TickerId, timeFrame, (ema(close, 2)) , barmerge.gaps_on, barmerge.lookahead_on) 
if not na(MyEMA)
    ema:=MyEMA
else 
    ema:=ema[1]
plot(barstate.islast and not barstate.isconfirmed?(ema+close*2)/3:MyEMA, "EMA", color(red,75), style=line, linewidth=9)

We can pull the higher timeframe ema in a variable using the security function. Then we can calculate live ema using the higher tf ema and current close.

In below example I have pulled higher tf ema in a variable called MyEMA. If it is not na then another variable called ema is set with this value. Else the variable ema is set with its own previous candles value. This way ema variable will always contain higher TF ema that was calculated till the last closed higher tf candle.

Then we use this higher tf ema and use the lower tf close on it to calculate the live ema.

TickerId = tickerid(syminfo.prefix, ticker) 
timeFrame = input(title="WaveDeltav2 Timeframe", type=resolution, defval="30")  
ema=0.0
MyEMA = security(TickerId, timeFrame, (ema(close, 2)) , barmerge.gaps_on, barmerge.lookahead_on) 
if not na(MyEMA)
    ema:=MyEMA
else 
    ema:=ema[1]
plot(barstate.islast and not barstate.isconfirmed?(ema+close*2)/3:MyEMA, "EMA", color(red,75), style=line, linewidth=9)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文