Here is my code. I want to plot the 9:30-10AM EST high and low. I hacked together this code, but I am confused on the time. It only works if I set it as 0800-0900, which doesn't make any sense. It breaks if I set it as 0930-1000.
这是我的代码。我想绘制美国东部夏令时9:30-10点的最高点和最低点。我破解了这个代码,但我搞不清时间了。只有当我将其设置为0800-0900时才有效,这没有任何意义。如果我把它设置为0930-1000,它就断了。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=4
study(title="my IB ext", shorttitle="my IB ext", overlay=true)
//Session Rules
bartimeSess = time(timeframe.period, "0930-1000:23456")
newbarSess = bartimeSess != bartimeSess[1]
high_range = valuewhen(newbarSess,high,0)
low_range = valuewhen(newbarSess,low,0)
//Calcul For Opening Range
locHigh = security(syminfo.tickerid, "30", high_range)
locLow = security(syminfo.tickerid, "30", low_range)
range = locHigh - locLow
//Plot Statements For Initial Balance
pLo = plot(time(timeframe.period) > 0 ? locLow : na,title="IB Low", color=color.rgb(255,0,0,75), linewidth=1, style = plot.style_stepline)
p50 = plot(locLow + (.5*range),title="IB Medium", color=color.rgb(255,255,0,75), linewidth=1, style = plot.style_stepline)
pHi = plot(time(timeframe.period) > 0 ? locHigh : na,title="IB High", color=color.rgb(255,0,0,75), linewidth=1, style = plot.style_stepline)
I want to plot the initial balance, but the time that is plotted doesn't correspond to the time I've listed in the arguments.
我想绘制初始余额,但绘制的时间与我在参数中列出的时间不一致。
更多回答
我是一名优秀的程序员,十分优秀!