//parameters :
boxsize=0.4
debut=143000
//------------------------ Etablissement du renko ----------------
//repris de Nicloas
once topprice = high
once bottomprice = low - boxsize*ticksize
if(high > topprice + boxsize) THEN
topprice = high
bottomprice = topprice - boxsize
ELSIF (low < bottomprice - boxsize) THEN
bottomprice = low
topprice = bottomprice + boxsize
ELSE
topprice = topprice
bottomprice = bottomprice
ENDIF
//------------------- Canal d'ouverture -------------------
once pH=high
once PB=low
once CA1=high
once CA2=high
once CA3=high
once CV1=low
once CV2=low
once CV3=low
once SSA1=high
once SSA2=high
once SSV1=low
once SSV2=low
if time<debut then
cpt=0
PH=topprice
PB=bottomprice
SSA1=topprice
SSA2=topprice
SSV1=bottomprice
SSV2=bottomprice
elsif topprice<>topprice[1] then
cpt=cpt+1
PH=max(PH,topprice)
PB=min(PB,bottomprice)
if high> CA3 then
SSA1=max(SSA1,high-2*ecart)
endif
if high[1]<=CA3 and high>=CA3 then
etat=3
endif
if etat=3 and high[1]>=CA and high<CA1 then
SSA2=max(tradeprice,high-2*ecart)
endif
if low<CV3 then
SSV1=min(SSV1,low+2*ecart)
endif
if low[1]>=CV3 and low<=CV3 then
etat=-3
endif
if etat=-3 then
SSV2=min(tradeprice,low+2*ecart)
endif
endif
if cpt>5 then
PH=PH[1]
PB=PB[1]
endif
ecart=PH-PB
CA1=PH+1*ecart
CA2=PH+2*ecart
CA3=pH+3*ecart
CV1=PB-1*ecart
CV2=PB-2*ecart
CV3=PB-3*ecart
if cpt>0 and cpt<6and cpt[1]<>cpt then
drawtext("#cpt#",barindex+3,PH+.5,dialog,bold,12)coloured(0,0,0)
endif
if cpt=0 then
CA1=high
CA2=high
CA3=high
CV1=low
CV2=low
CV3=low
endif
RETURN topprice style(line,1)coloured(0,0,0) as "topbox", bottomprice style(line,1)coloured(0,0,0) as "bottombox",PH style(line,2)coloured(0,0,0) as "PH",PB style(line,2)coloured(0,0,0) as "PB",CA1 style(dottedline,2)coloured(0,90,0)as"CA1",CA2 style(dottedline,2)coloured(0,90,0)as"CA2",CA3 style(dottedline,2)coloured(0,90,0)as"CA3",CV1 style(dottedline,2)coloured(210,0,0)as"CV1",CV2 style(dottedline,2)coloured(210,0,0)as"CV2",CV3 style(dottedline,2)coloured(210,0,0)as"CV3",SSA1 style(line,1)coloured(255,0,0) as "stopSA1",SSV1 style(line,1)coloured(255,0,255)as"stopSV1",SSA2 style(dottedline,1)coloured(255,0,255) as"stopSA2",SSV2 style(dottedline,1)coloured(255,0,255) as "stopSV2"