Voici l’indicateur tel que demandé. Il fonctionne sur n’importe quelle unité de temps intraday (1 min, 5 min, etc.). Il trace pour chaque journée :
- 1ere demi-heure 09:00-09:30 en bleu
- 2eme demi-heure 09:30-10:00 en orange
- 1ere heure complète 09:00-10:00 en vert
Pour chaque plage : le High, le Low, le Milieu, et les extensions +1x et -1x le range.
Pour adapter aux marchés US (09:30-10:00 / 10:00-10:30 / 09:30-10:30), modifie simplement les trois variables H1start, H1end et H2end en haut du code.
// ============================================================
// OPENING RANGE - 1ere et 2eme demi-heure + 1ere heure
// High, Low, Milieu, +Range, -Range de chaque plage
// ------------------------------------------------------------
// Couleurs :
// 1ere 1/2h -> Bleu
// 2eme 1/2h -> Orange
// 1ere heure -> Vert
// ============================================================
// --- HEURES DE REFERENCE (format HHMMSS)
// Marché Européen : ouverture 09:00
// Pour les US remplacer par 093000 / 100000 / 103000
H1start = 090000 // début 1ere demi-heure
H1end = 093000 // fin 1ere demi-heure = début 2eme
H2end = 100000 // fin 2eme demi-heure = fin 1ere heure
// ============================================================
// RESET AU DEBUT DE CHAQUE JOURNEE
// ============================================================
if IntradayBarIndex = 0 then
hi1 = high
lo1 = low
bi1start = barindex
bi1end = barindex
hi2 = undefined
lo2 = undefined
bi2start = barindex
bi2end = barindex
hiH = high
loH = low
biHstart = barindex
biHend = barindex
lock1 = 0
lock2 = 0
lockH = 0
endif
// ============================================================
// CALCUL - 1ere DEMI-HEURE (H1start -> H1end)
// ============================================================
if time >= H1start and time < H1end and lock1 = 0 then
if hi1 = undefined then
hi1 = high
lo1 = low
bi1start = barindex
else
hi1 = max(hi1, high)
lo1 = min(lo1, low)
endif
bi1end = barindex
endif
if time >= H1end and lock1 = 0 then
lock1 = 1
endif
// ============================================================
// CALCUL - 2eme DEMI-HEURE (H1end -> H2end)
// ============================================================
if time >= H1end and time < H2end and lock2 = 0 then
if hi2 = undefined then
hi2 = high
lo2 = low
bi2start = barindex
else
hi2 = max(hi2, high)
lo2 = min(lo2, low)
endif
bi2end = barindex
endif
if time >= H2end and lock2 = 0 then
lock2 = 1
endif
// ============================================================
// CALCUL - 1ere HEURE COMPLETE (H1start -> H2end)
// ============================================================
if time >= H1start and time < H2end and lockH = 0 then
if hiH = undefined then
hiH = high
loH = low
biHstart = barindex
else
hiH = max(hiH, high)
loH = min(loH, low)
endif
biHend = barindex
endif
if time >= H2end and lockH = 0 then
lockH = 1
endif
// ============================================================
// DESSIN - 1ere DEMI-HEURE
// Bleu foncé = High / Low
// Bleu clair = Milieu (50%)
// Bleu léger = Extensions +/- 1 Range
// ============================================================
if lock1 = 1 and hi1 <> undefined then
rng1 = hi1 - lo1
mid1 = (hi1 + lo1) / 2
ext1p = hi1 + rng1
ext1m = lo1 - rng1
// High
DRAWSEGMENT(bi1start, hi1, bi1end, hi1) COLOURED(0, 100, 255, 220)
// Low
DRAWSEGMENT(bi1start, lo1, bi1end, lo1) COLOURED(0, 100, 255, 220)
// Milieu
DRAWSEGMENT(bi1start, mid1, bi1end, mid1) COLOURED(0, 100, 255, 110)
// Extension haute +1 range
DRAWSEGMENT(bi1start, ext1p, bi1end, ext1p) COLOURED(0, 180, 255, 160)
// Extension basse -1 range
DRAWSEGMENT(bi1start, ext1m, bi1end, ext1m) COLOURED(0, 180, 255, 160)
endif
// ============================================================
// DESSIN - 2eme DEMI-HEURE
// Orange foncé = High / Low
// Orange clair = Milieu (50%)
// Jaune léger = Extensions +/- 1 Range
// ============================================================
if lock2 = 1 and hi2 <> undefined then
rng2 = hi2 - lo2
mid2 = (hi2 + lo2) / 2
ext2p = hi2 + rng2
ext2m = lo2 - rng2
// High
DRAWSEGMENT(bi2start, hi2, bi2end, hi2) COLOURED(255, 140, 0, 220)
// Low
DRAWSEGMENT(bi2start, lo2, bi2end, lo2) COLOURED(255, 140, 0, 220)
// Milieu
DRAWSEGMENT(bi2start, mid2, bi2end, mid2) COLOURED(255, 140, 0, 110)
// Extension haute +1 range
DRAWSEGMENT(bi2start, ext2p, bi2end, ext2p) COLOURED(255, 210, 0, 160)
// Extension basse -1 range
DRAWSEGMENT(bi2start, ext2m, bi2end, ext2m) COLOURED(255, 210, 0, 160)
endif
// ============================================================
// DESSIN - 1ere HEURE COMPLETE
// Vert foncé = High / Low
// Vert clair = Milieu (50%)
// Vert léger = Extensions +/- 1 Range
// ============================================================
if lockH = 1 and hiH <> undefined then
rngH = hiH - loH
midH = (hiH + loH) / 2
extHp = hiH + rngH
extHm = loH - rngH
// High
DRAWSEGMENT(biHstart, hiH, biHend, hiH) COLOURED(0, 200, 80, 220)
// Low
DRAWSEGMENT(biHstart, loH, biHend, loH) COLOURED(0, 200, 80, 220)
// Milieu
DRAWSEGMENT(biHstart, midH, biHend, midH) COLOURED(0, 200, 80, 110)
// Extension haute +1 range
DRAWSEGMENT(biHstart, extHp, biHend, extHp) COLOURED(0, 255, 120, 160)
// Extension basse -1 range
DRAWSEGMENT(biHstart, extHm, biHend, extHm) COLOURED(0, 255, 120, 160)
endif
RETURN