OPEN-SOURCE SCRIPT
Asia Session Range Checker

//version=5
indicator("Asia Session Range Checker", overlay=true)
// Define session times in London timezone
asiaStart = timestamp("Europe/London", year(timenow), month(timenow), dayofmonth(timenow), 00, 00)
asiaEnd = timestamp("Europe/London", year(timenow), month(timenow), dayofmonth(timenow), 08, 00)
inAsiaSession = (time >= asiaStart and time <= asiaEnd)
// Variables to track high/low of Asia session
var float asiaHigh = na
var float asiaLow = na
var float asiaRangePercent = na
var bool newDay = false
// Reset daily at the start of a new session
if (not inAsiaSession)
newDay := true
else
if (newDay)
asiaHigh := high
asiaLow := low
newDay := false
else
asiaHigh := math.max(asiaHigh, high)
asiaLow := math.min(asiaLow, low)
// Calculate % range after session ends
if (not inAsiaSession and not na(asiaHigh) and not na(asiaLow))
asiaRangePercent := (asiaHigh - asiaLow) / asiaLow * 100
// Show background for Asian session
bgcolor(inAsiaSession ? color.new(color.blue, 85) : na)
// Plot session high/low
plot(inAsiaSession ? asiaHigh : na, "Asia High", color=color.green, linewidth=1)
plot(inAsiaSession ? asiaLow : na, "Asia Low", color=color.red, linewidth=1)
// Show label with % range when session ends
if (not inAsiaSession and not na(asiaRangePercent) and bar_index % 50 == 0)
label.new(x=bar_index, y=high,
text="Asia Range: " + str.tostring(asiaRangePercent, "#.##") + "%",
style=label.style_label_down,
color=asiaRangePercent > 2 ? color.red : color.green,
textcolor=color.white,
size=size.small)
indicator("Asia Session Range Checker", overlay=true)
// Define session times in London timezone
asiaStart = timestamp("Europe/London", year(timenow), month(timenow), dayofmonth(timenow), 00, 00)
asiaEnd = timestamp("Europe/London", year(timenow), month(timenow), dayofmonth(timenow), 08, 00)
inAsiaSession = (time >= asiaStart and time <= asiaEnd)
// Variables to track high/low of Asia session
var float asiaHigh = na
var float asiaLow = na
var float asiaRangePercent = na
var bool newDay = false
// Reset daily at the start of a new session
if (not inAsiaSession)
newDay := true
else
if (newDay)
asiaHigh := high
asiaLow := low
newDay := false
else
asiaHigh := math.max(asiaHigh, high)
asiaLow := math.min(asiaLow, low)
// Calculate % range after session ends
if (not inAsiaSession and not na(asiaHigh) and not na(asiaLow))
asiaRangePercent := (asiaHigh - asiaLow) / asiaLow * 100
// Show background for Asian session
bgcolor(inAsiaSession ? color.new(color.blue, 85) : na)
// Plot session high/low
plot(inAsiaSession ? asiaHigh : na, "Asia High", color=color.green, linewidth=1)
plot(inAsiaSession ? asiaLow : na, "Asia Low", color=color.red, linewidth=1)
// Show label with % range when session ends
if (not inAsiaSession and not na(asiaRangePercent) and bar_index % 50 == 0)
label.new(x=bar_index, y=high,
text="Asia Range: " + str.tostring(asiaRangePercent, "#.##") + "%",
style=label.style_label_down,
color=asiaRangePercent > 2 ? color.red : color.green,
textcolor=color.white,
size=size.small)
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。