//------------------------------------------Calcul des renkos
BoxSize = Renko
// On aime bien que les valeurs des Renko soient "rondes"…
once renkoMax = ROUND(close / boxSize) * boxSize
once renkoMin = renkoMax - boxSize
IF high > renkoMax + boxSize THEN
WHILE high > renkoMax + boxSize
renkoMax = renkoMax + boxSize
renkoMin = renkoMin + boxSize
WEND
ELSIF low < renkoMin - boxSize THEN
WHILE low < renkoMin - boxSize
renkoMax = renkoMax - boxSize
renkoMin = renkoMin - boxSize
WEND
ENDIF
//------------------------------------------- Numerotation des renkos : on numérote à chaque nouveau niveau
If renkoMax <> renkoMax[1] then
nbT = nbT[1] + 1
endif
//---------------------------------------------- Calcul du canal d'ouverture
LimH = 0
limB = 100000
alpha1 = 0
if Time = 153000 then
Debut = nbT
LimH = High
LimB = Low
else
If nbT >= Debut and nbT < Debut + nbRMax then
LimH = Max(LimH[1],renkoMax)
LimB= Min(LimB[1],renkoMin)
else
LimH = LimH[1]
LimB = LimB[1]
alpha1 = 250
endif
endif
If LimH = 0 and LimB = 0then
alpha1 = 0
endif
//-------------------------------- Achats
NivA = 0
NivStopA = 0
alpha2 = 0
alpha3 = 0
If Time > 153000 and renkoMax crosses over LimH and NbAchat < AchatMax then
NbAchat = NbAchat[1] + 1
NivA = close
NivStopA = LimB
alpha3 = 0
DrawText("#NbAchat#",BarIndex,LimB - 50)//aux fins de vérification
else
NivA = NivA[1]
NivStopA = Max(NivStopA[1],renkoMin - 3 * BoxSize)
alpha2 = 250
alpha3 = 250
endif
if NbAchat >= AchatMax then
NivA = 0
NivStopA = 0
endif
If (renkoMin crosses under NivStopA) or (renkoMin[1] >= NivStopA[1] and renkoMin < NivStopA) then
NivStopA = 0
//NivStopA = NivStopA[1]
//alpha2 = 0
alpha3 = 0
endif
// on arrête le canal à 1935
If time > 223000 then
limH = 0
LimB = 0
NivA = 0
alpha1 = 0
NbAchat = 0
NivStopA = 0
endif
return renkoMax coloured(0,257,257) style(Line,1) as "RenkoMax",renkoMin coloured(0,257,257) style (Line,1) as "renkoMin",LimH coloured(244,102,27,alpha1) style(Line,2) as "LimH", LimB coloured(244,102,27,alpha1) style(Line,2) as "LimB",NivA coloured(0,0,200,alpha2) style(Line,2) as "NivA",NivStopA coloured(250,0,0,alpha3) style(Line,2) as "NivStopA"