需要保持固定的时间框架,即使在发生变化之后

Needed to keep fixed time frame , even after chnages

感谢阅读本文, 经过大量的谷歌搜索和搜索,我能够创建一个脚本来标记最高交易量的高低蜡烛

我目前面临的问题是我希望它在 15 分钟的时间范围内,目前,当我将时间范围从 15 小时更改为 1 小时或任何其他时间范围时,脚本会应用于该时间范围,是否有一些如何保持默认时间范围?

//@version=4
study("Volume High", shorttitle="VolHigh", overlay=true)

// This is a collab project with kisshore19 to mark the highest volume bar per day on the chart (specifically for lower timeframe charts, such as 5m)
i1 = input("", type = input.resolution)
var int dailyT = dayofweek
var float highestVolume = 0.0
var line hvMarkerHigh = na // line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, xloc=xloc.bar_index, extend=extend.both, color=color.blue, style=line.style_dotted, width=1)
var line hvMarkerLow = na
var int extendDistance = input(defval=10000000, title="Bar Extend Distance (MS)", type=input.integer) // extend distance in bars == bars * minutes * milliseconds
var color topLine = input(defval=color.black, title="Top Line", type=input.color)
var color botLine = input(defval=color.black, title="Bottom Line", type=input.color)

// once a new day starts, set hvMarker to na so we don't delete previous days' high volume marks
if dayofweek != dailyT
    // have moved to the next day
    highestVolume := 0
    hvMarkerHigh := na
    hvMarkerLow := na
    dailyT := dayofweek

if  hour(time) != 09 and minute(time) != 20 and hour(time) != 03 and minute(time) != 15 and volume > highestVolume
    highestVolume := volume
    line.delete(hvMarkerHigh)
    line.delete(hvMarkerLow)
    hvMarkerHigh := line.new(x1=time, y1=high, x2=time + extendDistance, y2=high, xloc=xloc.bar_time, extend=extend.right, color=topLine, style=line.style_solid, width=1)
    hvMarkerLow := line.new(x1=time, y1=low, x2=time + extendDistance, y2=low, xloc=xloc.bar_time, extend=extend.right, color=botLine, style=line.style_solid, width=1)

提出转换为版本 5 的建议,出现以下错误

第 1 步:将您当前的脚本转换为第 5 版 Pine 脚本。

Step 2: Upon the first line, add in this line: timeframe = "D". You may replace "D" with your own default timeframe. Done