Timeframe(4mn,UpdateOnClose)
mySar4 = SAR[0.02,0.02,0.2]
//
Timeframe(3mn,UpdateOnClose)
mySar3 = SAR[0.02,0.02,0.2]
//
Timeframe(2mn,UpdateOnClose)
mySar2 = SAR[0.02,0.02,0.2]
//
Timeframe(1mn,UpdateOnClose)
mySar1 = SAR[0.02,0.02,0.2]
//
Timeframe(default)
ONCE Offset = 0
Offset = abs(Offset - 1)
Precio = close
porcentaje4 = ((mySar4/Precio)-1)*100
porcentaje3 = ((mySar3/Precio)-1)*100
porcentaje2 = ((mySar2/Precio)-1)*100
porcentaje1 = ((mySar1/Precio)-1)*100
TF = 0
IF abs(porcentaje4) = min(abs(porcentaje4),min(abs(porcentaje3),min(abs(porcentaje2),abs(porcentaje1)))) THEN
TF = 4
ELSIF abs(porcentaje3) = min(abs(porcentaje4),min(abs(porcentaje3),min(abs(porcentaje2),abs(porcentaje1)))) THEN
TF = 3
ELSIF abs(porcentaje2) = min(abs(porcentaje4),min(abs(porcentaje3),min(abs(porcentaje2),abs(porcentaje1)))) THEN
TF = 2
ELSIF abs(porcentaje1) = min(abs(porcentaje4),min(abs(porcentaje3),min(abs(porcentaje2),abs(porcentaje1)))) THEN
TF = 1
ENDIF
IF TF THEN
IF Offset = 0 THEN
DrawText("#TF#",BarIndex,high + average[10,0](range)) coloured("Blue")
ELSE
DrawText("#TF#",BarIndex,low - average[10,0](range)) coloured("Green")
ENDIF
ENDIF
RETURN // mySar AS "SAR",Precio AS "Precio", porcentaje as "porcentaje"