Для PineScript v4.
Я не уверен, что вы или кто-либо еще сочтете это полезным, но это может быть применимо в качестве обходного пути для такого рода проблем.
Этот код рисует фоновую линию каждый день, кроме каждого первого дня недели, когда он рисует другой фон (с другим цветом). Он рисует фоны в зависимости от часа, НАД и ВЫШЕ свечи.
enableTLa = input(defval=true, type=input.bool, title="Enable Timelines 1D (TLa)")
colorA = input(title="Color TLa", type=input.color, defval=color.white)
enableTLd = input(defval=true, type=input.bool, title="Enable Timelines 1W (TLd)")
colorD = input(title="Color TLd", type=input.color, defval=color.yellow)
transpTL = input(defval = 80, title = "Timelines Transparency")
targetTime0 = timestamp(year, month, dayofmonth, 00, 00, 00) // 1D
timeframeRangeA = timeframe.period == "1" or timeframe.period == "3" or timeframe.period == "5" or timeframe.period == "15" or timeframe.period == "30" or timeframe.period == "45" or timeframe.period == "60"
timeframeRangeD = timeframe.period == "1" or timeframe.period == "3" or timeframe.period == "5" or timeframe.period == "15" or timeframe.period == "30" or timeframe.period == "45" or timeframe.period == "60" or timeframe.period == "120" or timeframe.period == "180" or timeframe.period == "240" or timeframe.period == "D"
// 1W, first day of the week, at first hour
bgcolor(targetTime0 == time and enableTLd and timeframeRangeD and dayofweek == dayofweek.monday ? colorD : na, transp=transpTL, editable=false)
// 1D, day of the week, at first hour
bgcolor(targetTime0 == time and enableTLa and timeframeRangeA and dayofweek != dayofweek.monday ? colorA : na, transp=transpTL, editable=false)
Это результат на 1-часовом таймфрейме:
![введите здесь описание изображения](https://i.stack.imgur.com/IPS96.png)
Как видите, он не проецирует фон в будущее.
person
carloswm85
schedule
21.02.2021