CPR但在凌晨4点策划,而不是市场开放

发布于 2025-02-06 01:17:07 字数 862 浏览 2 评论 0原文

该脚本正确地绘制了CPR,因此奏效了。但是,仅在市场开放后才吸引CPR。但是,计算枢轴所需的数据可以在前一天关闭市场。

我必须在以下脚本中修改什么,以便交易视图可以在每天凌晨4点计算和绘制CPR?

study(title="Central Pivot Range", shorttitle="CPR", overlay=true) 
sd = input(true, title="Show Daily Pivots?")

//Pivot Range Calculations - Mark Fisher
pivot = (high + low + close ) / 3.0 
bc = (high + low ) / 2.0 
tc = (pivot - bc) + pivot

//Daily Pivot Range 
dtime_pivot = security(tickerid, 'D', pivot[1]) 
dtime_bc = security(tickerid, 'D', bc[1]) 
dtime_tc = security(tickerid, 'D', tc[1]) 

offs_daily = 0 
plot(sd and dtime_pivot ? dtime_pivot : na, title="Daily Pivot",style=circles, color=fuchsia,linewidth=3) 
plot(sd and dtime_bc ? dtime_bc : na, title="Daily BC",style=circles, color=blue,linewidth=3)
plot(sd and dtime_tc ? dtime_tc : na, title="Daily TC",style=circles, color=blue,linewidth=3)

谢谢你!

This script works fantastic as it plots the CPR correctly; however, it draws the CPR only after the market opens. However, the data needed to calculate the pivots is available at market close the previous day.

What do I have to modify in the following script so that the trading view can calculate and plot the CPR at 4 am daily?

study(title="Central Pivot Range", shorttitle="CPR", overlay=true) 
sd = input(true, title="Show Daily Pivots?")

//Pivot Range Calculations - Mark Fisher
pivot = (high + low + close ) / 3.0 
bc = (high + low ) / 2.0 
tc = (pivot - bc) + pivot

//Daily Pivot Range 
dtime_pivot = security(tickerid, 'D', pivot[1]) 
dtime_bc = security(tickerid, 'D', bc[1]) 
dtime_tc = security(tickerid, 'D', tc[1]) 

offs_daily = 0 
plot(sd and dtime_pivot ? dtime_pivot : na, title="Daily Pivot",style=circles, color=fuchsia,linewidth=3) 
plot(sd and dtime_bc ? dtime_bc : na, title="Daily BC",style=circles, color=blue,linewidth=3)
plot(sd and dtime_tc ? dtime_tc : na, title="Daily TC",style=circles, color=blue,linewidth=3)

Thank you!

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

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

发布评论

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

评论(1

雨后咖啡店 2025-02-13 01:17:07

并不是您要寻找的内容,但这将开始在会议的最后一个栏上绘制第二天的枢轴。您可以将其用作编码特定需求的起点。

//@version=5
indicator(title="Central Pivot Range", shorttitle="CPR", max_lines_count=500, overlay=true) 

i_timeframe = input.timeframe('D', 'timeframe')
i_type      = input.string("DeMark", "Type", options=["Traditional", "Fibonacci", "Woodie", "Classic", "DeMark", "Camarilla"])

dayChange = session.islastbar_regular
pivotPointsArray = ta.pivot_point_levels(i_type, dayChange)

if dayChange or timeframe.change(i_timeframe)
    for pivotLevel in pivotPointsArray
        line.new(time, pivotLevel, time + timeframe.in_seconds(i_timeframe) * 1000, pivotLevel, xloc=xloc.bar_time)

Not entirely what you're looking for, but this will start drawing next day's pivots on the last bar of the session. You can use this as a starting point to code your specific needs.

//@version=5
indicator(title="Central Pivot Range", shorttitle="CPR", max_lines_count=500, overlay=true) 

i_timeframe = input.timeframe('D', 'timeframe')
i_type      = input.string("DeMark", "Type", options=["Traditional", "Fibonacci", "Woodie", "Classic", "DeMark", "Camarilla"])

dayChange = session.islastbar_regular
pivotPointsArray = ta.pivot_point_levels(i_type, dayChange)

if dayChange or timeframe.change(i_timeframe)
    for pivotLevel in pivotPointsArray
        line.new(time, pivotLevel, time + timeframe.in_seconds(i_timeframe) * 1000, pivotLevel, xloc=xloc.bar_time)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文