PulseHub
OPEN-SOURCE SCRIPT

ICT Sessions

155
//version=6
indicator("ICT交易时段(含重合)精简版", overlay=true, max_bars_back=500)

// ==================== 设置 ====================
tz = input.string("America/New_York", "时区(推荐纽约)", options=["America/New_York", "Asia/Shanghai", "UTC"])

showAsia = input.bool(true, "显示亚洲盘")
showLondon = input.bool(true, "显示伦敦盘")
showNY = input.bool(true, "显示纽约盘")
showOverlap = input.bool(true, "显示重要重合")

// 时段时间
asiaS = input.session("1900-0400", "亚洲盘时间")
londonS = input.session("0200-1200", "伦敦盘时间")
nyS = input.session("0800-1700", "纽约盘时间")

// 颜色
asiaColor = input.color(color.new(#F5E6C8, 78), "亚洲颜色")
londonColor = input.color(color.new(#C8E6C9, 78), "伦敦颜色")
nyColor = input.color(color.new(#E1BEE7, 78), "纽约颜色")
overlapColor = input.color(color.new(#9C27B0, 65), "伦敦-纽约重合颜色")

// ==================== 核心逻辑 ====================
isWeekday = dayofweek != dayofweek.saturday and dayofweek != dayofweek.sunday

isAsia = isWeekday and not na(time(timeframe.period, asiaS, tz))
isLondon = isWeekday and not na(time(timeframe.period, londonS, tz))
isNY = isWeekday and not na(time(timeframe.period, nyS, tz))

isLondonNY = isLondon and isNY
isAsiaLon = isAsia and isLondon

// ==================== 背景绘制 ====================
bgcolor(showAsia and isAsia and not isAsiaLon and not isLondonNY ? asiaColor : na)
bgcolor(showLondon and isLondon and not isAsiaLon and not isLondonNY ? londonColor : na)
bgcolor(showNY and isNY and not isLondonNY ? nyColor : na)

// 重合(重点)
bgcolor(showOverlap and isAsiaLon ? color.new(#80CBC4, 70) : na)
bgcolor(showOverlap and isLondonNY ? overlapColor : na)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.