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)
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.