Bonjour,
Je n’avais encore jamais utilisé la fonction Time. Le code ci-dessous peut-il t’aider ? A adapter bien évidemment car j’ai placé un maximum d’éléments pédagogiques visuels.
Cordialement.
//---- Code testé sur ETHUSD 10 mn
//
//----- Horloge
T= Time
T0= 000000
T1= 080000
T2= 173000
T3= 235000
//----- Positions horloge
IF Time= T0 THEN
xT0= BarIndex
yM= Close // Matin fermé
ELSIF Time= T1 THEN
xT1= BarIndex
yOpen= Close // Ouvert
ELSIF Time= T2 THEN
xT2= BarIndex
yS= Close // Soir fermé
ELSIF Time = T3 THEN
xT3= BarIndex
ENDIF
//----- Process 1: Fond: Trading ouvert
IF Time >= T1 AND Time <= T2 THEN
//T1 et T2 balaye la plage horaire
BackGroundColor(0,100,0)
ENDIF
IF Time >= T1 AND Time = T2 THEN
//T1 amorce et Time croit
//T2 stoppe
DrawPoint(xT1,yOpen,3) Coloured(0,255,0)
DrawText("Open", xT1, yOpen+5, Dialog, Bold, 14) Coloured(0,255,0)
DrawPoint(xT2,yOpen,3) Coloured(0,255,0)
DrawText("Close", xT2, yOpen+5, Dialog, Bold, 14) Coloured(0,255,0)
DrawSegment(xT1, yOpen, xT2, yOpen) Coloured(0,255,0) Style(Line,4)
ENDIF
//----- Process 2: Trading fermé
//----- Matin
IF Time >= T0 AND Time <= T1 THEN
//T0 amorce et Time croit
//T1 balaye la plage horaire matinale et stoppe l'horloge
BackGroundColor(160,0,0)
ENDIF
IF Time >= T0 AND Time = T1 THEN
//T0 amorce et Time croit
//T1 stoppe l'horloge matinale
DrawPoint(xT0,yM,3) Coloured(255,255,0)
DrawText("0<", xT0, yM+5, Dialog, Bold, 20) Coloured(255,255,0)
DrawPoint(xT1,yM,3) Coloured(255,255,0)
DrawText(">1", xT1, yM+5, Dialog, Bold, 20) Coloured(255,255,0)
DrawSegment(xT0, yM, xT1, yM) Coloured(255,255,0) Style(Line,4)
ENDIF
//----- Soir
IF Time >= T2 AND Time <= T3 THEN
BackGroundColor(100,0,0)
ENDIF
IF Time >= T2 AND Time = T3 THEN
DrawPoint(xT2,yS,3) Coloured(0,160,255)
DrawText("2<", xT2, yS-5, Dialog, Bold, 20) Coloured(0,160,255)
DrawPoint(xT3,yS,3) Coloured(0,160,255)
DrawText(">3", xT3, yS-5, Dialog, Bold, 20) Coloured(0,160,255)
DrawSegment(xT2, yS, xT3, yS) Coloured(0,160,255) Style(Line,4)
ENDIF
RETURN