DEFPARAM CalculateOnLastBars = 1000
DEFPARAM DrawOnLastBarOnly = True
IF BarIndex = 0 THEN
Massimo = 0
Minimo = 0
hh = 0
ll = 999999
ENDIF
IF hour <> hour[1] THEN
Massimo = hh
Minimo = ll
hh = high
ll = low
ELSE
hh = max(hh,high)
ll = min(ll,low)
ENDIF
Diff = abs(Massimo - Minimo)
IF Massimo > Minimo THEN
Fib236 = Massimo - (Diff * 0.236) //23.6% fibonacci
Fib382 = Massimo - (Diff * 0.382) //38.2% fibonacci
Fib500 = Massimo - (Diff * 0.500) //50.0% fibonacci
Fib618 = Massimo - (Diff * 0.618) //61.8% fibonacci
Fib764 = Massimo - (Diff * 0.764) //76.4% fibonacci
ELSE
Fib236 = Minimo + (Diff * 0.236) //23.6% fibonacci
Fib382 = Minimo + (Diff * 0.382) //38.2% fibonacci
Fib500 = Minimo + (Diff * 0.500) //50.0% fibonacci
Fib618 = Minimo + (Diff * 0.618) //61.8% fibonacci
Fib764 = Minimo + (Diff * 0.764) //76.4% fibonacci
ENDIF
DRAWHLINE(Massimo) coloured(0,255,0,255)
DRAWHLINE(Minimo) coloured(0,255,0,255)
DRAWTEXT("--------#Fib236# (23.6%)------",barindex,Fib236,SansSerif,Bold,10)coloured(0,128,0,255)
DRAWTEXT("--------#Fib382# (38.2%)------",barindex,Fib382,SansSerif,Bold,10)coloured(0,128,0,255)
DRAWTEXT("--------#Fib500# (50.0%)------",barindex,Fib500,SansSerif,Bold,10)coloured(0,128,0,255)
DRAWTEXT("--------#Fib618# (61.8%)------",barindex,Fib618,SansSerif,Bold,10)coloured(0,128,0,255)
DRAWTEXT("--------#Fib764# (76.4%)------",barindex,Fib764,SansSerif,Bold,10)coloured(0,128,0,255)
RETURN