较低的时间范围成交量条 [英] Lower Timeframe Volume Bars

查看:47
本文介绍了较低的时间范围成交量条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 5m 图表上,我试图根据构成 5m 体积条的五个 1m 体积条的红色/绿色体积绘制部分绿色和部分红色的体积条.

On a 5m chart, I am trying to plot volume bars that are colored partially green and partially red, in accordance with the red/green volume of the five 1m volume bars that comprise the 5m volume bar.

我认为这会很简单,但我在通过 security() 函数计算前五个 1m 指数的交易量时遇到了问题.

I thought this would be pretty straight forward, but I am running into problems calculating the volume from the preceding five 1m indice via the security() function.

在我看来,以下代码应该为两个 plotchar() 调用提供相同的值.

The way I see it, the following code should give me the same value for both of the plotchar() calls.

然而,事实并非如此!

想法?

预先感谢您的任何建议.

Thanks in advance for any suggestions.

//@version=4
study("LTF Vol", format=format.volume, overlay=false)

1mVol = security(syminfo.tickerid, "1", volume)

5mVol = security(syminfo.tickerid, "5", volume)

sumFive1mVol = 1mVol[0] + 1mVol[1] + 1mVol[2] + 1mVol[3] + 1mVol[4]

plotchar(sumFive1mVol, char="", color=color.red, title="sumFive1mVol")

plotchar(5mVol, char="", color=color.blue, title="5mVol")

附言我意识到我最终可以使用 sum(source, length) 来定义我的 sumFive1mVol,但我在这里拼写出来是为了尽可能明确——并帮助解决问题.

P.S. I realize that I can eventually use sum(source, length) in order to define my sumFive1mVol, but I spelled it out here in order to be as explicit as possible -- and in order to help hunt down the problem.

推荐答案

在条内分辨率下使用 security() 不受支持,并且会对您的脚本施加重要限制(没有实时数据,没有警报,等等.).请参阅 这篇文章 讨论它们和示例代码.

Using security() at intrabar resolutions is not supported and will impose important constraints on your script (no realtime data, no alerts, etc.). See this article for a discussion of them and example code.

如果您仍然有兴趣查看代码做您需要的事情,请参阅我的 Delta Volume Columns Pro 指标,它挖掘柱内交易量以构建 Delta 交易量信息.

If you nonetheless interested in looking at code doing what you need, see my Delta Volume Columns Pro indicator, which mines intrabar volume to build delta volume information.

披露:此答案中的链接指向 PineCoders 常见问题解答条目.我是 PineCoders 社区的成员,我很可能写了那个 FAQ 条目.PineCoders 是由 TradingView 支持的 Pine 编码志愿者小组,PineCoders 的网站具有严格的教育意义.TradingView 和 PineCoders 都不会从向 pinecoders.com 发送流量中获得经济利益,并且该网站不包含附属/推荐链接.

这篇关于较低的时间范围成交量条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆