OPEN-SOURCE SCRIPT

ICT Sessions

227
//version=6
indicator("ICT交易时段", overlay=true)

// ==================== 设置 ====================
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, "显示重合时段")

// 重点:加上 :23456 (只周一到周五)
asiaS = input.session("1900-0400:23456", "亚洲盘时间")
londonS = input.session("0200-1200:23456", "伦敦盘时间")
nyS = input.session("0800-1700:23456", "纽约盘时间")

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), "伦敦-纽约重合颜色")
asiaLonColor = input.color(color.new(#80CBC4, 70), "亚洲-伦敦重合颜色")

// ==================== 核心逻辑 ====================
isAsia = not na(time(timeframe.period, asiaS, tz))
isLondon = not na(time(timeframe.period, londonS, tz))
isNY = not na(time(timeframe.period, nyS, tz))

isLondonNY = isLondon and isNY
isAsiaLon = isAsia and isLondon

// ==================== 背景绘制 ====================
bgcolor(showOverlap and isLondonNY ? overlapColor : na)
bgcolor(showOverlap and isAsiaLon ? asiaLonColor : na)

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)

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。