简体   繁体   English

在 Pine Script Tradingview 中使用 Security() 的 EMA 问题

[英]Problem with EMA using Security() in Pine Script Tradingview

I´m need to code an indicator that let me know the value of an ema from another TF (part of a bigger indicator).我需要编写一个指标,让我知道另一个 TF 的 ema 值(更大指标的一部分)。

This is my code to get a 9 period ema over a bbw on 15 minutes TF:这是我在 15 分钟 TF 上通过 bbw 获得 9 周期 ema 的代码:

bbw2 = security(syminfo.tickerid, "15", bbw(src, length, mult))
emabbw2 = ema(bbw2, 9)

But the value I get of emabbw2 when I am in 1M is not the same I get when I´m in 15M, so how can I code this to get the correct ema value from 15M when I´m in 1M chart?但是当我在 1M 时获得的 emabbw2 值与我在 15M 时获得的值不同,那么当我在 1M 图表中时,如何编码以从 15M 中获得正确的 ema 值?

Thank you!谢谢!

Need to let security() make the calcs in its context:需要让security()在其上下文中进行计算:

bbw2 = bbw(src, length, mult)
emabbw2 = security(syminfo.tickerid, "15", ema(bbw2, 9))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM