OPEN-SOURCE SCRIPT
Cassures Tokyo pendant New York

//version=5
indicator("Cassures Tokyo pendant New York", overlay=true)
// Paramètres de sessions
// Début et fin de Tokyo (00h00 - 08h00 GMT)
tokyo_start = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 0, 0)
tokyo_end = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 8, 0)
// Début et fin de New York (13h30 - 22h00 GMT)
ny_start = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 13, 30)
ny_end = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 22, 0)
// Initialisation des variables persistantes
var float tokyo_high = na
var float tokyo_low = na
var bool ny_started = false
var bool high_broken = false
var bool low_broken = false
// Reset des valeurs à chaque nouvelle journée
if (time >= tokyo_start and time < tokyo_end)
tokyo_high := na
tokyo_low := na
high_broken := false
low_broken := false
ny_started := false
// Détection du high/low Tokyo
if (time >= tokyo_start and time < tokyo_end)
tokyo_high := na(tokyo_high) ? high : math.max(tokyo_high, high)
tokyo_low := na(tokyo_low) ? low : math.min(tokyo_low, low)
// Détection des cassures pendant New York
if (time >= ny_start and time < ny_end)
ny_started := true
if not na(tokyo_high) and high > tokyo_high
high_broken := true
if not na(tokyo_low) and low < tokyo_low
low_broken := true
// Affichage des niveaux Tokyo
plot(tokyo_high, "Tokyo High", color=color.green, linewidth=1, style=plot.style_linebr)
plot(tokyo_low, "Tokyo Low", color=color.red, linewidth=1, style=plot.style_linebr)
// Surlignage visuel en session NY selon cassure
bgcolor(ny_started and high_broken and low_broken ? color.orange : ny_started and high_broken ? color.new(color.green, 80) : ny_started and low_broken ? color.new(color.red, 80) : na)
// Affichage texte sur le graphique
label_id = label.new(x=bar_index, y=high, text="", style=label.style_label_down, textcolor=color.white, size=size.tiny, color=color.gray)
if (ny_started)
label_text = high_broken and low_broken ? "Cassure HIGH & LOW Tokyo" :
high_broken ? "Cassure HIGH Tokyo" :
low_broken ? "Cassure LOW Tokyo" :
"Aucune cassure"
label.set_text(label_id, label_text)
label.set_xy(label_id, bar_index, high + syminfo.mintick * 10)
indicator("Cassures Tokyo pendant New York", overlay=true)
// Paramètres de sessions
// Début et fin de Tokyo (00h00 - 08h00 GMT)
tokyo_start = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 0, 0)
tokyo_end = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 8, 0)
// Début et fin de New York (13h30 - 22h00 GMT)
ny_start = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 13, 30)
ny_end = timestamp("GMT+0", year(timenow), month(timenow), dayofmonth(timenow), 22, 0)
// Initialisation des variables persistantes
var float tokyo_high = na
var float tokyo_low = na
var bool ny_started = false
var bool high_broken = false
var bool low_broken = false
// Reset des valeurs à chaque nouvelle journée
if (time >= tokyo_start and time < tokyo_end)
tokyo_high := na
tokyo_low := na
high_broken := false
low_broken := false
ny_started := false
// Détection du high/low Tokyo
if (time >= tokyo_start and time < tokyo_end)
tokyo_high := na(tokyo_high) ? high : math.max(tokyo_high, high)
tokyo_low := na(tokyo_low) ? low : math.min(tokyo_low, low)
// Détection des cassures pendant New York
if (time >= ny_start and time < ny_end)
ny_started := true
if not na(tokyo_high) and high > tokyo_high
high_broken := true
if not na(tokyo_low) and low < tokyo_low
low_broken := true
// Affichage des niveaux Tokyo
plot(tokyo_high, "Tokyo High", color=color.green, linewidth=1, style=plot.style_linebr)
plot(tokyo_low, "Tokyo Low", color=color.red, linewidth=1, style=plot.style_linebr)
// Surlignage visuel en session NY selon cassure
bgcolor(ny_started and high_broken and low_broken ? color.orange : ny_started and high_broken ? color.new(color.green, 80) : ny_started and low_broken ? color.new(color.red, 80) : na)
// Affichage texte sur le graphique
label_id = label.new(x=bar_index, y=high, text="", style=label.style_label_down, textcolor=color.white, size=size.tiny, color=color.gray)
if (ny_started)
label_text = high_broken and low_broken ? "Cassure HIGH & LOW Tokyo" :
high_broken ? "Cassure HIGH Tokyo" :
low_broken ? "Cassure LOW Tokyo" :
"Aucune cassure"
label.set_text(label_id, label_text)
label.set_xy(label_id, bar_index, high + syminfo.mintick * 10)
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.