OPEN-SOURCE SCRIPT

Session Asiatique (1h à 6h - Heure de Paris)

75
//version=5
indicator("Session Asiatique (1h à 6h - Heure de Paris)", overlay=true)

// Variables pour le rectangle de la session
var box sessionBox = na
var float sessionHigh = na
var float sessionLow = na

// Heure actuelle en UTC
utcHour = hour(time)

// Heure actuelle en heure de Paris
parisHour = hour(time, "Europe/Paris")

// Détection de la session asiatique (1h à 6h heure de Paris)
inSession = parisHour >= 1 and parisHour < 6
startSession = inSession and not inSession[1]
endSession = not inSession and inSession[1]

// Début de la session : création du rectangle et initialisation des bornes
if startSession
sessionLow := low
sessionHigh := high
sessionBox := box.new(left=bar_index, right=bar_index, top=high, bottom=low, border_color=color.rgb(118, 118, 119), bgcolor=color.new(#404140, 85))

// Mise à jour du rectangle pendant la session
if inSession and not na(sessionBox)
sessionHigh := math.max(sessionHigh, high)
sessionLow := math.min(sessionLow, low)
box.set_right(sessionBox, bar_index)
box.set_top(sessionBox, sessionHigh)
box.set_bottom(sessionBox, sessionLow)

// Fin de la session : finalisation du rectangle
if endSession and not na(sessionBox)
box.set_right(sessionBox, bar_index)

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.