获取特定时间的开盘价

编程入门 行业动态 更新时间:2024-10-22 16:18:56
本文介绍了获取特定时间的开盘价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家晚上好,

我的第一篇文章,所以请耐心等待.

My first post so please bear with me.

捕获特定时间开盘价以复制另一个时区开盘价(由下一个 24 小时的线表示).

Capture price open at a certain time to replicate another time zone opening (represented by a line for the next 24 hours).

目前使用以下但固定为UTC

Currently using the below but that is fixed to UTC

dOpen = security(syminfo.tickerid, "D", open, lookahead = barmerge.lookahead_on)

[当前 dOpen 设置为安全 UTC][1]我可以为我的 dOpen 选择另一个时间.

[Current dOpen set to security UTC][1] I am after being able to select another time for my dOpen.

目前有使用 UTC 的上述设置,但我很想知道我是否可以将它复制到其他时区.

Currently have the above setup to use UTC, but am intrigued to see if I can replicate it for other time zones.

我读了很多书,但似乎找不到合适的材料来帮助我.任何指导将不胜感激.

I have been reading a lot but don't seem to be able to find the right material to assist me. Any guidance will be gratefully received.

编辑更新 29/01/2021我已经做了一些功课并有以下内容,但我认为它没有应有的干净.如果有人能把目光投向它并提供一些建议,我将不胜感激.

Edit Update 29/01/2021 I have done some homework and have the below, but I think that its not as clean as it should be. I would be grateful if someone could cast their eyes over it and offer some suggestions.

//@version=4 study("Timed Open", overlay=true) offset_val = input(title="Label Offset", type=input.integer, defval=20) LonOpenInput = input('0800-0801:1234567', title="London") //set the opening range you are interested in NYOpenInput = input('1300-1301:1234567', title="New York") //set the opening range you are interested in AsiaOpenInput = input('2300-2301:1234567', title="Asia") //set the opening range you are interested in LonOpen = time(timeframe.period, LonOpenInput) NYOpen = time(timeframe.period, NYOpenInput) AsiaOpen = time(timeframe.period, AsiaOpenInput) var LonOpenPA = 0.0 if LonOpen if not LonOpen[1] LonOpenPA := open else LonOpenPA := max(open, LonOpenPA) var NYOpenPA = 0.0 if NYOpen if not NYOpen[1] NYOpenPA := open else NYOpenPA := max(open, NYOpenPA) var AsiaOpenPA = 0.0 if AsiaOpen if not AsiaOpen[1] AsiaOpenPA := open else AsiaOpenPA := max(open, AsiaOpenPA) plot(not LonOpen ? LonOpenPA : na, title="London Open", color=color.yellow, linewidth=1, style=plot.style_linebr) plotshape(LonOpenPA, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Open", offset = offset_val, transp=20, title="London Open") plot(not NYOpen ? NYOpenPA : na, title="New York Open", color=color.blue, linewidth=1, style=plot.style_linebr) plotshape(NYOpenPA, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Open", offset = offset_val, transp=20, title="New York Open") plot(not AsiaOpen ? AsiaOpenPA : na, title="Asia Open", color=color.orange, linewidth=1, style=plot.style_linebr) plotshape(AsiaOpenPA, style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.white, show_last=1, text="Asia Open", offset = offset_val, transp=20, title="Asia Open")

编辑更新 30/01/2021 @ 1400

Edit Update 30/01/2021 @ 1400

更新脚本以捕捉每日和每周市场开盘时间并应用来自@AnyDozer 的建议评论

Updated script to capture Daily and weekly market opening times and applied suggested comments from @AnyDozer

//@version=4 study("Help (Timed Open) - DozerAssit", overlay=true) offset_val = input(title="Label Offset", type=input.integer, defval=30) LonDOpenInput = input('0800-0801:134567', title="London Daily Open") //set the opening range you are interested in LonWOpenInput = input('0800-0801:2', title="London Weekly Open") //set the opening range you are interested in NYDOpenInput = input('1300-1301:134567', title="New York Daily Open") //set the opening range you are interested in NYWOpenInput = input('1300-1301:2', title="New York Weekly Open") //set the opening range you are interested in AsiaDOpenInput = input('2300-2301:134567', title="Asia Daily Open") //set the opening range you are interested in AsiaWOpenInput = input('2300-2301:2', title="Asia Weekly Open") //set the opening range you are interested in LonDOpen = time("1", LonDOpenInput) LonWOpen = time("1", LonWOpenInput) NYDOpen = time("1", NYDOpenInput) NYWOpen = time("1", NYWOpenInput) AsiaDOpen = time("1", AsiaDOpenInput) AsiaWOpen = time("1", AsiaWOpenInput) var LonDOpenPA = 0.0 if LonDOpen if not LonDOpen[1] LonDOpenPA := open var LonWOpenPA = 0.0 if LonWOpen if not LonWOpen[1] LonWOpenPA := open var NYDOpenPA = 0.0 if NYDOpen if not NYDOpen[1] NYDOpenPA := open var NYWOpenPA = 0.0 if NYWOpen if not NYWOpen[1] NYWOpenPA := open var AsiaDOpenPA = 0.0 if AsiaDOpen if not AsiaDOpen[1] AsiaDOpenPA := open var AsiaWOpenPA = 0.0 if AsiaWOpen if not AsiaWOpen[1] AsiaWOpenPA := open plot(not LonDOpen ? LonDOpenPA : na, title="London D Open", color=color.yellow, linewidth=1, style=plot.style_linebr) plotshape(LonDOpenPA, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London D Open", offset = offset_val, transp=20, title="London D Open") plot(not LonWOpen ? LonWOpenPA : na, title="London W Open", color=color.yellow, linewidth=2, style=plot.style_linebr) plotshape(LonWOpenPA, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London W Open", offset = offset_val, transp=20, title="London W Open") plot(not NYDOpen ? NYDOpenPA : na, title="New York D Open", color=color.blue, linewidth=1, style=plot.style_linebr) plotshape(NYDOpenPA, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York D Open", offset = offset_val, transp=20, title="New York D Open") plot(not NYWOpen ? NYWOpenPA : na, title="New York W Open", color=color.blue, linewidth=2, style=plot.style_linebr) plotshape(NYWOpenPA, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York W Open", offset = offset_val, transp=20, title="New York W Open") plot(not AsiaDOpen ? AsiaDOpenPA : na, title="Asia D Open", color=color.orange, linewidth=1, style=plot.style_linebr) plotshape(AsiaDOpenPA, style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.white, show_last=1, text="Asia D Open", offset = offset_val, transp=20, title="Asia D Open") plot(not AsiaWOpen ? AsiaWOpenPA : na, title="Asia W Open", color=color.orange, linewidth=2, style=plot.style_linebr) plotshape(AsiaWOpenPA, style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.white, show_last=1, text="Asia W Open", offset = offset_val, transp=20, title="Asia W Open")

我遇到了以下问题,但在实施时遇到问题(仍在播放),

I have come across the below but am having issues implementing it (still playing),

onlyLastperiode = input (title="show only last periode", type=input.bool , defval=false) closeTime = security(syminfo.tickerid, "D", time_close[0], lookahead=true) paintitNot = timenow > (closeTime + (24*60*1000*60))

如何在情节中实现这一点----

How to implement this to the plot ----

onlyLastperiode and paintitNot

推荐答案

修复了脚本,使其能够输出一些内容.在屏幕截图中说明您期望的结果.

Fixed the script so that it would output something. Explain what result you expect in the screenshot.

//@version=4 study("Help (Timed Open)", overlay=true) offset_val = input(title="Label Offset", type=input.integer, defval=20) LonOpenInput = input('0800-0801:1234567', title="London") //set the opening range you are interested in NYOpenInput = input('1300-1301:1234567', title="New York") //set the opening range you are interested in AsiaOpenInput = input('2300-2301:1234567', title="Asia") //set the opening range you are interested in LonOpen = time("1", LonOpenInput) NYOpen = time("1", NYOpenInput) AsiaOpen = time("1", AsiaOpenInput) var LonOpenPA = 0.0 if LonOpen if not LonOpen[1] LonOpenPA := open else LonOpenPA := max(open, LonOpenPA) var NYOpenPA = 0.0 if NYOpen if not NYOpen[1] NYOpenPA := open else NYOpenPA := max(open, NYOpenPA) var AsiaOpenPA = 0.0 if AsiaOpen if not AsiaOpen[1] AsiaOpenPA := open else AsiaOpenPA := max(open, AsiaOpenPA) plot(not LonOpen ? LonOpenPA : na, title="London Open", color=color.yellow, linewidth=1, style=plot.style_linebr) plotshape(LonOpenPA, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Open", offset = offset_val, transp=20, title="London Open") plot(not NYOpen ? NYOpenPA : na, title="New York Open", color=color.blue, linewidth=1, style=plot.style_linebr) plotshape(NYOpenPA, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Open", offset = offset_val, transp=20, title="New York Open") plot(not AsiaOpen ? AsiaOpenPA : na, title="Asia Open", color=color.orange, linewidth=1, style=plot.style_linebr) plotshape(AsiaOpenPA, style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.white, show_last=1, text="Asia Open", offset = offset_val, transp=20, title="Asia Open")

更多推荐

获取特定时间的开盘价

本文发布于:2023-10-25 22:02:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1528236.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:开盘价   时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!